diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-07-24 19:34:00 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-07-24 19:34:00 +0200 |
commit | c4f8c289147f26fa424692c30d656322c0a2e1e3 (patch) | |
tree | 6be1fde5fa08b0b521f5e49a22c129947792c0fa /src | |
parent | 54165b3740adf57503f94fa7cd32781a05920a1e (diff) |
Add some error context
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/maillist_view.rs | 13 | ||||
-rw-r--r-- | src/main_view.rs | 1 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/maillist_view.rs b/src/maillist_view.rs index 7f9fee5..4a38768 100644 --- a/src/maillist_view.rs +++ b/src/maillist_view.rs @@ -1,6 +1,7 @@ use std::path::PathBuf; use anyhow::Result; +use anyhow::Context; use cursive::Cursive; use cursive::Printer; use cursive::Rect; @@ -32,14 +33,16 @@ impl MaillistView { .ok_or_else(|| { error!("Failed to parse timestamp: {}", msg.date()); anyhow!("Failed to parse timestamp: {}", msg.date()) - })?; + }) + .context(format!("Getting the date of message {}", msg.id()))?; let from = msg.header("From")? .map(|f| f.to_string()) .ok_or_else(|| { error!("Failed to get From for {}", msg.id()); anyhow!("Failed to get From for {}", msg.id()) - })?; + }) + .context(format!("Getting the 'From' of message {}", msg.id()))?; let to = msg.header("To")? .map(|c| c.to_string()) @@ -52,7 +55,8 @@ impl MaillistView { .ok_or_else(|| { error!("Failed to get Subject for {}", msg.id()); anyhow!("Failed to get Subject for {}", msg.id()) - })?; + }) + .context(format!("Getting the subject of message {}", msg.id()))?; Ok(MailListingData { mail_id, @@ -63,7 +67,8 @@ impl MaillistView { subject, }) }) - .collect::<Result<Vec<_>>>()?; + .collect::<Result<Vec<_>>>() + .context(format!("Creating MaillinglistView for '{}' on {}", query, database_path.display()))?; debug!("Found {} entries", items.len()); let tab = TableView::<MailListingData, MailListingColumn>::new() diff --git a/src/main_view.rs b/src/main_view.rs index 03666b9..6950c9f 100644 --- a/src/main_view.rs +++ b/src/main_view.rs @@ -155,7 +155,6 @@ impl MainView { Dialog::around(edit_view) .title("Query") .min_width(80) - .full_height() }) } |