melib: add summary field to MeliError
parent
7010ee7495
commit
a059e4ad4c
|
@ -37,7 +37,8 @@ pub type Result<T> = result::Result<T, MeliError>;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
pub struct MeliError {
|
pub struct MeliError {
|
||||||
details: String,
|
pub summary: Option<String>,
|
||||||
|
pub details: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MeliError {
|
impl MeliError {
|
||||||
|
@ -46,9 +47,18 @@ impl MeliError {
|
||||||
M: Into<String>,
|
M: Into<String>,
|
||||||
{
|
{
|
||||||
MeliError {
|
MeliError {
|
||||||
|
summary: None,
|
||||||
details: msg.into(),
|
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 {
|
impl fmt::Display for MeliError {
|
||||||
|
|
Loading…
Reference in New Issue