Browse Source

melib: add summary field to MeliError

tags/alpha-0.4.1
Manos Pitsidianakis 2 years ago
parent
commit
a059e4ad4c
Signed by: epilys GPG Key ID: 73627C2F690DF710
  1. 12
      melib/src/error.rs

12
melib/src/error.rs

@ -37,7 +37,8 @@ pub type Result<T> = result::Result<T, MeliError>;
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct MeliError {
details: String,
pub summary: Option<String>,
pub details: String,
}
impl MeliError {
@ -46,9 +47,18 @@ impl MeliError {
M: Into<String>,
{
MeliError {
summary: None,
details: msg.into(),
}
}
pub fn set_summary<M>(mut self, summary: M) -> MeliError
where
M: Into<String>,
{
self.summary = Some(summary.into());
self
}
}
impl fmt::Display for MeliError {

Loading…
Cancel
Save