Simplify error handling

This commit is contained in:
Matthias Beyer 2016-09-04 17:56:38 +02:00
parent 02b58a45c5
commit 66ccd97ef2

View file

@ -1,8 +1,8 @@
use std::process::exit; use std::process::exit;
use libimagdiary::diary::Diary; use libimagdiary::diary::Diary;
use libimagdiary::error::DiaryError as DE;
use libimagdiary::error::DiaryErrorKind as DEK; use libimagdiary::error::DiaryErrorKind as DEK;
use libimagdiary::error::MapErrInto;
use libimagentrylist::listers::core::CoreLister; use libimagentrylist::listers::core::CoreLister;
use libimagentrylist::lister::Lister; use libimagentrylist::lister::Lister;
use libimagrt::runtime::Runtime; use libimagrt::runtime::Runtime;
@ -40,7 +40,7 @@ pub fn list(rt: &Runtime) {
CoreLister::new(&entry_to_location_listing_string) CoreLister::new(&entry_to_location_listing_string)
.list(es) // TODO: Do not ignore non-ok()s .list(es) // TODO: Do not ignore non-ok()s
.map_err(|e| DE::new(DEK::IOError, Some(Box::new(e)))) .map_err_into(DEK::IOError)
}) })
.map(|_| debug!("Ok")) .map(|_| debug!("Ok"))
.map_err(|e| trace_error(&e)) .map_err(|e| trace_error(&e))