use serde::Deserialize;
#[derive(Deserialize, Debug, PartialEq)]
pub struct CallingError {
error: InnerError,
}
impl CallingError {
pub fn code(&self) -> u64 {
self.error.code
}
pub fn message(&self) -> &str {
&self.error.message
}
}
#[derive(Deserialize, Debug, PartialEq)]
pub struct InnerError {
code: u64,
message: String,
}
#[derive(Debug)]
pub enum APIError {
ReqwestError(reqwest::Error),
CallingError(CallingError),
}
impl From<reqwest::Error> for APIError {
fn from(a: reqwest::Error) -> Self {
Self::ReqwestError(a)
}
}