use std::convert::Infallible;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("network error: {0}")]
Network(#[from] isahc::Error),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("Invalid URL: {0}")]
InvalidUrl(#[from] url::ParseError),
}
impl From<Infallible> for Error {
fn from(x: Infallible) -> Error {
match x {}
}
}
pub type Result<T> = std::result::Result<T, Error>;
#[cfg(test)]
mod tests {
use super::Error;
#[test]
fn test_send() {
fn assert_send<T: Send>() {}
assert_send::<Error>();
}
#[test]
fn test_sync() {
fn assert_send<T: Sync>() {}
assert_send::<Error>();
}
}