1use serde::Deserialize;
2use thiserror::Error as ThisError;
3
4#[derive(Deserialize, Debug, Clone)]
5pub struct APIErrorResponse {
6 pub message: String,
7 pub documentation_url: String,
8}
9
10#[derive(ThisError, Debug, Clone)]
11pub enum Error {
12 #[error("Error: {0}")]
13 Error(String),
14 #[error("Request failed with {0}")]
15 RequestFailed(APIErrorResponse),
16}
17
18impl std::fmt::Display for APIErrorResponse {
19 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
20 write!(f, "Error: {}", self.message)
21 }
22}