GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — clibrowser/src/error.rs at main · allthingssecurity/clibrowser Expand file tree/ Copy patherror.rsMore file actions 63 lines (50 loc) · 1.81 KB / Copy patherror.rsFile metadata and controls63 lines (50 loc) · 1.81 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 use thiserror::Error; #[derive(Error, Debug)] pub enum BrowserError { #[error("No page loaded. Run `clibrowser get <url>` first.")] NoPageLoaded, #[error("No current URL. Run `clibrowser get <url>` first.")] NoCurrentUrl, #[error("Invalid CSS selector: {0}")] InvalidSelector(String), #[error("No element found matching selector: {0}")] NoMatch(String), #[error("Index {index} out of range (found {count} matches)")] IndexOutOfRange { index: usize, count: usize }, #[error("No form found matching selector: {0}")] NoFormFound(String), #[error("No form found at index {0}")] NoFormAtIndex(usize), #[error("HTTP error {status}: {url}")] HttpStatus { status: u16, url: String }, #[error("Network error: {0}")] Network(String), #[error("Session not found: {0}")] SessionNotFound(String), #[error("{0}")] Other(String), } impl BrowserError { pub fn exit_code(&self) -> i32 { match self { BrowserError::HttpStatus { .. } => 2, BrowserError::Network(_) => 3, _ => 1, } } pub fn error_code(&self) -> &'static str { match self { BrowserError::NoPageLoaded => "no_page", BrowserError::NoCurrentUrl => "no_url", BrowserError::InvalidSelector(_) => "invalid_selector", BrowserError::NoMatch(_) => "no_match", BrowserError::IndexOutOfRange { .. } => "index_out_of_range", BrowserError::NoFormFound(_) => "no_form", BrowserError::NoFormAtIndex(_) => "no_form", BrowserError::HttpStatus { .. } => "http_error", BrowserError::Network(_) => "network_error", BrowserError::SessionNotFound(_) => "session_not_found", BrowserError::Other(_) => "error", } } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |