|
|
@ -31,13 +31,16 @@ impl Rear {
|
|
|
|
let error = error.into();
|
|
|
|
let error = error.into();
|
|
|
|
let message = message.into();
|
|
|
|
let message = message.into();
|
|
|
|
|
|
|
|
|
|
|
|
Self { error, message }
|
|
|
|
Self {
|
|
|
|
|
|
|
|
error,
|
|
|
|
|
|
|
|
message,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Display for Rear {
|
|
|
|
impl Display for Rear {
|
|
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
|
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
|
|
|
if !self.message.is_empty() {
|
|
|
|
if ! self.message.is_empty() {
|
|
|
|
write!(f, "{}", self.error)
|
|
|
|
write!(f, "{}", self.error)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
write!(f, "{}\n{}", &self.message, &self.error)
|
|
|
|
write!(f, "{}\n{}", &self.message, &self.error)
|
|
|
@ -47,19 +50,20 @@ impl Display for Rear {
|
|
|
|
|
|
|
|
|
|
|
|
impl From<Box<dyn Error>> for Rear {
|
|
|
|
impl From<Box<dyn Error>> for Rear {
|
|
|
|
fn from(error: Box<dyn Error>) -> Self {
|
|
|
|
fn from(error: Box<dyn Error>) -> Self {
|
|
|
|
Self { error, message: String::new() }
|
|
|
|
Self {
|
|
|
|
|
|
|
|
error: error,
|
|
|
|
|
|
|
|
message: String::new(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl From<std::io::Error> for Rear {
|
|
|
|
|
|
|
|
fn from(error: std::io::Error) -> Self {
|
|
|
|
|
|
|
|
Self { message: error.to_string(), error: error.into() }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "serde_json")]
|
|
|
|
#[cfg(feature = "serde_json")]
|
|
|
|
impl From<serde_json::Error> for Rear {
|
|
|
|
impl From<serde_json::Error> for Rear {
|
|
|
|
fn from(error: serde_json::Error) -> Self {
|
|
|
|
fn from(error: serde_json::Error) -> Self {
|
|
|
|
Self { message: error.to_string(), error: error.into() }
|
|
|
|
let message: String = error.to_string();
|
|
|
|
|
|
|
|
Self {
|
|
|
|
|
|
|
|
error: error.into(),
|
|
|
|
|
|
|
|
message: message,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|