error.rs (526B)
1 #[derive(thiserror::Error, Debug)] 2 pub enum Error { 3 #[error("reqwest error: {0}")] 4 Reqwest(#[from] reqwest::Error), 5 #[error("invalid API key provided")] 6 InvalidAPIKey, 7 #[error("unsplash error: {0}")] 8 Unsplash(String), 9 #[error("json: {0}")] 10 SerdeJson(#[from] serde_json::Error), 11 #[error("unsplash response missing header: {0}")] 12 MissingHeader(&'static str), 13 #[error("unsplash response malformed")] 14 MalformedResponse, 15 } 16 17 pub type Result<T, E = Error> = std::result::Result<T, E>;