melib/error: do not discard old summary in set_summary

memfd
Manos Pitsidianakis 2020-06-20 11:12:37 +03:00
parent 75f9256a50
commit 8bfdce6658
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 5 additions and 7 deletions

View File

@ -92,7 +92,11 @@ impl MeliError {
where
M: Into<Cow<'static, str>>,
{
self.summary = Some(summary.into());
if let Some(old_summary) = self.summary.take() {
self.summary = Some(format!("{}. {}", old_summary, summary.into()).into());
} else {
self.summary = Some(summary.into());
}
self
}
@ -118,12 +122,6 @@ impl fmt::Display for MeliError {
}
}
impl Into<String> for MeliError {
fn into(self) -> String {
self.details.into()
}
}
impl Error for MeliError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
self.source.as_ref().map(|s| &(*(*s)) as _)