Skip to main content

chan/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5    #[error("HTTP error: {0}")]
6    Http(#[from] reqwest::Error),
7
8    #[error("JSON decode error: {0}")]
9    Json(#[from] serde_json::Error),
10
11    #[error("resource not found: {0}")]
12    NotFound(String),
13
14    #[error("4chan API returned status {status} for {url}")]
15    Status { status: u16, url: String },
16
17    #[error("invalid header value: {0}")]
18    InvalidHeader(String),
19}
20
21pub type Result<T> = std::result::Result<T, Error>;