1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use serde_derive::*; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct APIError { errors: Vec<ErrorObject>, } #[derive(Serialize, Deserialize, Debug, Clone)] pub struct ErrorObject { code: i64, message: String, } impl std::convert::From<APIError> for anyhow::Error { fn from(error: APIError) -> Self { anyhow::anyhow!(error) } }