| 1 | use thiserror::Error; |
| 2 | |
| 3 | #[derive(Debug, Error)] |
| 4 | pub enum BrowserError { |
| 5 | #[error("no browser on {0}")] |
| 6 | NoBrowser(String), |
| 7 | #[error("chrome not found: {0}")] |
| 8 | ChromeNotFound(String), |
| 9 | #[error("cannot read Windows environment: {0}")] |
| 10 | Environment(String), |
| 11 | #[error("something already listens on port {0}")] |
| 12 | PortBusy(u16), |
| 13 | #[error("chrome did not open debugging port {port} within {seconds}s")] |
| 14 | StartTimeout { port: u16, seconds: u64 }, |
| 15 | #[error("chrome on port {port} did not close within {seconds}s")] |
| 16 | StopTimeout { port: u16, seconds: u64 }, |
| 17 | #[error("the browser on port {0} holds a WebDriver session of another process")] |
| 18 | SessionTaken(u16), |
| 19 | #[error("http: {0}")] |
| 20 | Http(String), |
| 21 | #[error("devtools: {0}")] |
| 22 | Cdp(String), |
| 23 | #[error("unexpected response: {0}")] |
| 24 | Parse(String), |
| 25 | #[error("launch failed: {0}")] |
| 26 | Launch(#[from] std::io::Error), |
| 27 | } |