Fix imag-bookmark error handling

This commit is contained in:
Matthias Beyer 2018-02-12 21:02:40 +01:00
parent c0000b6410
commit 86abfb88a4

View file

@ -52,7 +52,7 @@ use libimagbookmark::collection::BookmarkCollection;
use libimagbookmark::collection::BookmarkCollectionStore; use libimagbookmark::collection::BookmarkCollectionStore;
use libimagbookmark::error::BookmarkError as BE; use libimagbookmark::error::BookmarkError as BE;
use libimagbookmark::link::Link as BookmarkLink; use libimagbookmark::link::Link as BookmarkLink;
use libimagerror::trace::{MapErrTrace, trace_error, trace_error_exit}; use libimagerror::trace::{MapErrTrace, trace_error};
mod ui; mod ui;
@ -130,19 +130,15 @@ fn list(rt: &Runtime) {
.ok_or(BE::from(format!("No BookmarkcollectionStore '{}' found", coll))) .ok_or(BE::from(format!("No BookmarkcollectionStore '{}' found", coll)))
.map_err_trace_exit_unwrap(1); .map_err_trace_exit_unwrap(1);
match collection.links(rt.store()) { let links = collection.links(rt.store()).map_err_trace_exit_unwrap(1);
Ok(links) => { debug!("Listing...");
debug!("Listing..."); for (i, link) in links.enumerate() {
for (i, link) in links.enumerate() { match link {
match link { Ok(link) => println!("{: >3}: {}", i, link),
Ok(link) => println!("{: >3}: {}", i, link), Err(e) => trace_error(&e)
Err(e) => trace_error(&e) }
} };
}; debug!("... ready with listing");
debug!("... ready with listing");
},
Err(e) => trace_error_exit(&e, 1),
}
info!("Ready"); info!("Ready");
} }