From bc861c52f2f5a38ad632042de0a09b64027fc607 Mon Sep 17 00:00:00 2001 From: aaron-jack-manning Date: Sat, 10 Sep 2022 15:46:45 +1000 Subject: [PATCH] better errors when editing tasks directly --- src/edit.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/edit.rs b/src/edit.rs index 7a89b41..c94f82d 100755 --- a/src/edit.rs +++ b/src/edit.rs @@ -73,7 +73,13 @@ pub fn edit_raw(id : Id, vault_folder : path::PathBuf, editor : &str, state : &m } } else { - let mut edited_task = tasks::Task::load_direct(temp_path.clone(), true)?; + let mut edited_task = tasks::Task::load_direct(temp_path.clone(), true) + .map_err(|err| { + match err { + error::Error::TomlDe(err) => error::Error::Generic(format!("Bad toml data - {}", err)), + x => x, + } + })?; // Make sure ID is not changed. if edited_task.data.id != task.data.id {