use std::error::Error as StdError; use hyper::StatusCode; use serde::Deserialize; #[derive(Debug)] pub struct Error { pub(super) source: Option>, pub(super) r#type: ErrorType, } #[derive(Debug)] pub enum ErrorType { ChunkingResponse, HttpHeaderCreation { name: String, }, HttpRequestBuild, Json, Parsing { body: Vec, }, RequestError, RequestTimeout, Response { body: Vec, error: ApiError, status: StatusCode, }, } #[derive(Debug, Deserialize)] pub struct ApiError { pub code: String, pub message: String, }