From a059e4ad4cd57b5f17ad2df3b246da93c5a2dde5 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Tue, 3 Dec 2019 13:27:00 +0200 Subject: [PATCH] melib: add summary field to MeliError --- melib/src/error.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 {