diff --git a/lib/domain/libimagtodo/src/iter.rs b/lib/domain/libimagtodo/src/iter.rs index c2871c5a..c5c63943 100644 --- a/lib/domain/libimagtodo/src/iter.rs +++ b/lib/domain/libimagtodo/src/iter.rs @@ -20,6 +20,9 @@ use libimagstore::storeid::StoreIdIterator; use libimagstore::storeid::StoreId; +use error::Result; +use error::TodoError as TE; + pub struct TaskIdIterator(StoreIdIterator); impl TaskIdIterator { @@ -31,14 +34,15 @@ impl TaskIdIterator { } impl Iterator for TaskIdIterator { - type Item = StoreId; + type Item = Result; fn next(&mut self) -> Option { loop { match self.0.next() { None => return None, - Some(n) => if n.is_in_collection(&["todo", "taskwarrior"]) { - return Some(n) + Some(Err(e)) => return Some(Err(e).map_err(TE::from)), + Some(Ok(n)) => if n.is_in_collection(&["todo", "taskwarrior"]) { + return Some(Ok(n)) }, // else continue } }