use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct ErrJson {
pub timestamp: DateTime<Utc>,
pub status: u16,
pub error: Option<Box<str>>,
pub path: Option<Box<str>>,
pub message: Option<Box<str>>,
pub exception: Option<Box<str>>,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_de() {
match serde_json::from_str::<ErrJson>(include_str!(
"../../tests/response_body_json_files/err_wrong_access_key_secret.json"
)) {
Ok(err_json) => {
println!("{:?}", err_json);
}
Err(err) => panic!("{}", err),
}
match serde_json::from_str::<ErrJson>(include_str!(
"../../tests/response_body_json_files/err_invalid_format_of_notifications.json"
)) {
Ok(err_json) => {
println!("{:?}", err_json);
}
Err(_err) => {
}
}
}
}