summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-05-02 13:54:26 +0200
committerMatthias Beyer <mail@beyermatthias.de>2020-06-01 14:02:08 +0200
commitbfeaac6d8cf4ddc9d2c6db86e384c67a1524ec8c (patch)
tree0565986a722a12045f62c93621e8fc116b7254d2
parent80564a1d5a985ee77d3b8f5ca4a2d10a4f4a2d58 (diff)
Make error message more verbose
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--bin/domain/imag-mail/src/new.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/domain/imag-mail/src/new.rs b/bin/domain/imag-mail/src/new.rs
index 4af5a11a..66af2d47 100644
--- a/bin/domain/imag-mail/src/new.rs
+++ b/bin/domain/imag-mail/src/new.rs
@@ -21,6 +21,7 @@ use std::path::PathBuf;
use std::collections::BTreeMap;
use failure::Fallible as Result;
+use failure::ResultExt;
use failure::err_msg;
use toml_query::read::TomlValueReadExt;
use clap::ArgMatches;
@@ -223,7 +224,10 @@ fn edit_message_validated(rt: &Runtime, mut msg: String) -> Result<String> {
debug!("Remainder: {:?}", remainder);
if remainder.len() != 0 {
- Err(err_msg("Some bytes are not parsed... cannot verify that the mail is correct!"))?
+ let remainder_s = String::from_utf8_lossy(remainder);
+ Err(err_msg("Some bytes are not parsed... cannot verify that the mail is correct!"))
+ .context(format!("Parsing: {}", remainder_s))
+ .context(format!("Parsing email: {}", msg))?
}
Ok(msg)