diff --git a/melib/src/error.rs b/melib/src/error.rs index 07c9d633..fca37b08 100644 --- a/melib/src/error.rs +++ b/melib/src/error.rs @@ -37,7 +37,8 @@ pub type Result = result::Result; #[derive(Debug, Clone, Deserialize, Serialize)] pub struct MeliError { - details: String, + pub summary: Option, + pub details: String, } impl MeliError { @@ -46,9 +47,18 @@ impl MeliError { M: Into, { MeliError { + summary: None, details: msg.into(), } } + + pub fn set_summary(mut self, summary: M) -> MeliError + where + M: Into, + { + self.summary = Some(summary.into()); + self + } } impl fmt::Display for MeliError {