Add more context in error messages
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
741e8acb8a
commit
1f97584738
|
@ -30,6 +30,7 @@ use itertools::Itertools;
|
|||
use chrono::naive::NaiveDateTime;
|
||||
use chrono::Timelike;
|
||||
use failure::Fallible as Result;
|
||||
use failure::ResultExt;
|
||||
use failure::Error;
|
||||
|
||||
use crate::entry::IsDiaryEntry;
|
||||
|
@ -141,6 +142,7 @@ impl Diary for Store {
|
|||
fn diary_names(&self) -> Result<DiaryNameIterator> {
|
||||
self.entries()
|
||||
.map(|it| DiaryNameIterator::new(it.into_storeid_iter()))
|
||||
.context("Failed building DiaryNameIteator from entries iterator")
|
||||
.map_err(Error::from)
|
||||
}
|
||||
|
||||
|
|
|
@ -234,6 +234,7 @@ impl FromStoreId for DiaryId {
|
|||
let day: Result<u32> = next_component(&mut cmps)
|
||||
.and_then(|s| {
|
||||
s.parse::<u32>()
|
||||
.context("Failed to parse day from u32")
|
||||
.map_err(Error::from)
|
||||
.context(err_msg("ID parse error"))
|
||||
.map_err(Error::from)
|
||||
|
@ -242,6 +243,7 @@ impl FromStoreId for DiaryId {
|
|||
let month: Result<u32> = next_component(&mut cmps)
|
||||
.and_then(|s| {
|
||||
s.parse::<u32>()
|
||||
.context("Failed to parse month from u32")
|
||||
.map_err(Error::from)
|
||||
.context(err_msg("ID Parse error"))
|
||||
.map_err(Error::from)
|
||||
|
@ -250,6 +252,7 @@ impl FromStoreId for DiaryId {
|
|||
let year: Result<i32> = next_component(&mut cmps)
|
||||
.and_then(|s| {
|
||||
s.parse::<i32>()
|
||||
.context("Failed to parse year from i32")
|
||||
.map_err(Error::from)
|
||||
.context(err_msg("ID Parse error"))
|
||||
.map_err(Error::from)
|
||||
|
|
Loading…
Reference in New Issue