diff --git a/imag-notes/src/main.rs b/imag-notes/src/main.rs index 4dcaac34..c73297d9 100644 --- a/imag-notes/src/main.rs +++ b/imag-notes/src/main.rs @@ -69,14 +69,19 @@ fn edit(rt: &Runtime) { } fn edit_entry(rt: &Runtime, name: String) -> bool { - let note = Note::retrieve(rt.store(), name); - if note.is_err() { - trace_error(¬e.unwrap_err()); - warn!("Cannot edit nonexistent Note"); - return false - } + let mut note = match Note::get(rt.store(), name) { + Ok(Some(note)) => note, + Ok(None) => { + warn!("Cannot edit nonexistent Note"); + return false + }, + Err(e) => { + trace_error(&e); + warn!("Cannot edit nonexistent Note"); + return false + }, + }; - let mut note = note.unwrap(); if let Err(e) = note.edit_content(rt) { trace_error(&e); warn!("Editing failed");