From 715753ed25b319e7cc88695d743659c38a40837b Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 30 Apr 2018 17:28:54 +0200 Subject: [PATCH] Refactor libimagtodo to fit new store iterator interface --- lib/domain/libimagtodo/src/iter.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 } }