force a reason when calling set_msg_failed() (#3410)

* force a reason when calling `set_msg_failed()`

the string is displayed to the user,
so even _some_ context as "NDN without further details"
is better than an empty string.

* make clippy happy

* add CHANGELOG entry
This commit is contained in:
bjoern
2022-06-08 21:25:34 +02:00
committed by GitHub
parent db28349703
commit d286872782
6 changed files with 15 additions and 20 deletions

View File

@@ -1398,11 +1398,11 @@ impl MimeMessage {
}
if let Some(failure_report) = &self.failure_report {
let error = parts
.iter()
.find(|p| p.typ == Viewtype::Text)
.map(|p| p.msg.clone());
if let Err(e) = message::handle_ndn(context, failure_report, error).await {
let error = parts.iter().find(|p| p.typ == Viewtype::Text).map_or_else(
|| "Non-Delivery-Notification without further details.".to_string(),
|p| p.msg.clone(),
);
if let Err(e) = message::handle_ndn(context, failure_report, &error).await {
warn!(context, "Could not handle ndn: {}", e);
}
}