diff --git a/imag-diary/src/edit.rs b/imag-diary/src/edit.rs index cc3362f3..bfcfa018 100644 --- a/imag-diary/src/edit.rs +++ b/imag-diary/src/edit.rs @@ -3,11 +3,12 @@ use chrono::naive::datetime::NaiveDateTime; use libimagdiary::diary::Diary; use libimagdiary::diaryid::DiaryId; -use libimagdiary::error::DiaryError as DE; use libimagdiary::error::DiaryErrorKind as DEK; +use libimagdiary::error::MapErrInto; use libimagentryedit::edit::Edit; use libimagrt::runtime::Runtime; use libimagerror::trace::trace_error; +use libimagerror::into::IntoError; use libimagtimeui::datetime::DateTime; use libimagtimeui::parse::Parse; @@ -36,10 +37,10 @@ pub fn edit(rt: &Runtime) { }; match to_edit { - Some(Ok(mut e)) => e.edit_content(rt).map_err(|e| DE::new(DEK::IOError, Some(Box::new(e)))), + Some(Ok(mut e)) => e.edit_content(rt).map_err_into(DEK::IOError), Some(Err(e)) => Err(e), - None => Err(DE::new(DEK::EntryNotInDiary, None)), + None => Err(DEK::EntryNotInDiary.into_error()), } .map_err(|e| trace_error(&e)).ok(); }