1use serde::{Deserialize, Serialize};
2use std::fmt::Display;
3
4pub mod api_types;
5pub mod http_api;
6pub mod id_types;
7pub mod protocol;
8pub mod token;
9
10#[derive(Debug, Serialize, Deserialize)]
11pub struct ApiErrorResponse {
12 pub code: String,
13 pub id: Option<String>,
14}
15
16impl std::error::Error for ApiErrorResponse {}
17
18impl Display for ApiErrorResponse {
19 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20 write!(f, "Api error: {{ code: {}, id: {:?} }}", self.code, self.id)
21 }
22}