Refactor: use map_err_into() instead of manual building

This commit is contained in:
Matthias Beyer 2016-09-04 17:30:40 +02:00
parent f8db1273e7
commit 44675a4b4f

View file

@ -2,8 +2,8 @@ use std::process::exit;
use libimagdiary::diary::Diary; use libimagdiary::diary::Diary;
use libimagdiary::diaryid::DiaryId; use libimagdiary::diaryid::DiaryId;
use libimagdiary::error::DiaryError as DE;
use libimagdiary::error::DiaryErrorKind as DEK; use libimagdiary::error::DiaryErrorKind as DEK;
use libimagdiary::error::MapErrInto;
use libimagentryedit::edit::Edit; use libimagentryedit::edit::Edit;
use libimagrt::runtime::Runtime; use libimagrt::runtime::Runtime;
use libimagerror::trace::trace_error; use libimagerror::trace::trace_error;
@ -98,8 +98,7 @@ pub fn create(rt: &Runtime) {
Ok(()) Ok(())
} else { } else {
debug!("Editing new diary entry"); debug!("Editing new diary entry");
entry.edit_content(rt) entry.edit_content(rt).map_err_into(DEK::DiaryEditError)
.map_err(|e| DE::new(DEK::DiaryEditError, Some(Box::new(e))))
} }
}); });