chrome_for_testing/error.rs
1use std::borrow::Cow;
2use thiserror::Error;
3
4/// Errors that can occur when using this crate.
5#[derive(Debug, Error)]
6pub enum Error {
7 /// A URL could not be parsed.
8 #[error("URL parse error: {0}")]
9 UrlParsing(#[from] url::ParseError),
10
11 /// An HTTP request failed.
12 #[error("HTTP request failed: {0}")]
13 Request(#[from] reqwest::Error),
14
15 /// The current platform is not supported by `chrome-for-testing`.
16 #[error("Platform (os: {os}, arch: {arch}) is not supported.")]
17 UnsupportedPlatform {
18 /// The operating system name, e.g. "linux".
19 os: Cow<'static, str>,
20
21 /// The system architecture name, e.g. "`x86_64`".
22 arch: Cow<'static, str>,
23 },
24}
25
26/// A convenience type alias for `Result<T, Error>`.
27pub type Result<T> = std::result::Result<T, Error>;