diff --git a/src/main.rs b/src/main.rs index 7c6323c..9f76e49 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,16 +39,15 @@ fn main_body() -> Result<(), Box> { run_compare( std::env::args() .nth(1) - .expect("Pass a single file into this script."), + .ok_or("Pass a single file into this script.")?, ) } #[cfg(feature = "compare")] fn run_compare>(todo_org_path: P) -> Result<(), Box> { - let org_contents = std::fs::read_to_string(todo_org_path.as_ref()).expect("Read org file."); + let org_contents = std::fs::read_to_string(todo_org_path.as_ref())?; let (remaining, rust_parsed) = document(org_contents.as_str()).expect("Org Parse failure"); - let org_sexp = - emacs_parse_org_document(todo_org_path.as_ref()).expect("Use emacs to parse org file."); + let org_sexp = emacs_parse_org_document(todo_org_path.as_ref())?; let (_remaining, parsed_sexp) = sexp_with_padding(org_sexp.as_str()).expect("Sexp Parse failure"); @@ -57,11 +56,8 @@ fn run_compare>(todo_org_path: P) -> Result<(), Box