Rewrite edit_entry() to use Store::get()
This commit is contained in:
parent
8caeb17729
commit
bbad841a60
1 changed files with 12 additions and 7 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue