diff --git a/bin/domain/imag-diary/src/list.rs b/bin/domain/imag-diary/src/list.rs index 99409d3c..051fb028 100644 --- a/bin/domain/imag-diary/src/list.rs +++ b/bin/domain/imag-diary/src/list.rs @@ -38,16 +38,8 @@ pub fn list(rt: &Runtime) { Diary::entries(rt.store(), &diaryname) .map_dbg_str("Ok") .map_err_trace_exit_unwrap(1) - .filter_map(|entry| { - entry - .map_dbg(|e| format!("Filtering: {:?}", e)) - .map_err_trace() // error tracing here - .ok() // so we can ignore errors here - }) - .for_each(|e| { - writeln!(out, "{}", e - .get_location() - .clone() + .for_each(|id| { + writeln!(out, "{}", id .without_base() .to_str() .map_err_trace() diff --git a/bin/domain/imag-diary/src/view.rs b/bin/domain/imag-diary/src/view.rs index 7752c693..66a952c0 100644 --- a/bin/domain/imag-diary/src/view.rs +++ b/bin/domain/imag-diary/src/view.rs @@ -22,6 +22,7 @@ use libimagdiary::viewer::DiaryViewer as DV; use libimagrt::runtime::Runtime; use libimagerror::trace::MapErrTrace; use libimagutil::warn_exit::warn_exit; +use libimagstore::iter::get::StoreIdGetIteratorExtension; use util::get_diary_name; @@ -29,9 +30,16 @@ pub fn view(rt: &Runtime) { let diaryname = get_diary_name(rt).unwrap_or_else(|| warn_exit("No diary name", 1)); let hdr = rt.cli().subcommand_matches("view").unwrap().is_present("show-header"); - Diary::entries(rt.store(), &diaryname) - .and_then(|entries| DV::new(hdr).view_entries(entries.into_iter().filter_map(Result::ok))) - .map_err_trace() - .ok(); + let entries = Diary::entries(rt.store(), &diaryname) + .map_err_trace_exit_unwrap(1) + .into_get_iter(rt.store()) + .filter_map(Result::ok) + .map(|e| e.unwrap_or_else(|| { + error!("Failed to fetch entry"); + ::std::process::exit(1) + })); + + DV::new(hdr).view_entries(entries) + .map_err_trace_exit_unwrap(1); }