mollie_api/models/
error_response.rs1use core::fmt;
2use std::collections::HashMap;
3
4use serde::{Deserialize, Serialize};
5
6use super::link::Link;
7
8#[derive(Debug, Deserialize, Serialize)]
10pub struct ErrorResponse {
11 pub status: u16,
13
14 pub title: String,
16
17 pub detail: String,
19
20 #[serde(rename(deserialize = "_links"))]
22 pub links: HashMap<String, Link>,
23}
24
25impl fmt::Display for ErrorResponse {
26 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27 write!(
28 f,
29 "{}",
30 serde_json::to_string(&self).unwrap_or("Response error".to_string())
31 )
32 }
33}