fix: add backtrace recording and output on errors
This commit is contained in:
12
bin/main.ml
12
bin/main.ml
@@ -70,7 +70,8 @@ let ical2rem (args : CommandLine.cli_args) ical_files =
|
||||
good_rems @ good_rems_acc
|
||||
end
|
||||
with e ->
|
||||
Utils.warn "Error: could not read file %s: %s\n" filename (Printexc.to_string e);
|
||||
Printf.eprintf "Error: could not read file %s: %s\n%s" filename (Printexc.to_string e)
|
||||
(Printexc.get_backtrace ());
|
||||
good_rems_acc)
|
||||
in
|
||||
|
||||
@@ -82,7 +83,12 @@ let ical2rem (args : CommandLine.cli_args) ical_files =
|
||||
in
|
||||
try ListLabels.iter good_rems ~f:(fun rem -> Printf.printf "%s" (Remind.string_of_rem rem))
|
||||
with e ->
|
||||
Printf.eprintf "Error processing reminders: %s\n" (Printexc.to_string e);
|
||||
Printf.eprintf "Error processing reminders: %s\n%s" (Printexc.to_string e) (Printexc.get_backtrace ());
|
||||
exit 1
|
||||
|
||||
let () = if !Sys.interactive then () else exit (CommandLine.main ical2rem)
|
||||
let () =
|
||||
if !Sys.interactive then ()
|
||||
else begin
|
||||
Printexc.record_backtrace true;
|
||||
exit (CommandLine.main ical2rem)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user