podman_client/models/podman/error/
mod.rs1use core::fmt;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Deserialize, Serialize)]
6pub struct Error {
7 pub cause: String,
8 pub message: String,
9 pub response: u16,
10}
11
12impl fmt::Display for Error {
13 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14 write!(
15 f,
16 "{} (code {}): {}",
17 self.cause, self.response, self.message,
18 )
19 }
20}
21
22impl fmt::Debug for Error {
23 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24 let json = serde_json::to_string_pretty(self).map_err(|_| fmt::Error)?;
25 f.write_str(&json)
26 }
27}
28
29impl std::error::Error for Error {}