fix: add backtrace recording and output on errors

This commit is contained in:
2026-05-24 18:35:19 +02:00
parent 8bb075153d
commit f038e7f382

View File

@@ -70,7 +70,8 @@ let ical2rem (args : CommandLine.cli_args) ical_files =
good_rems @ good_rems_acc good_rems @ good_rems_acc
end end
with e -> 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) good_rems_acc)
in in
@@ -82,7 +83,12 @@ let ical2rem (args : CommandLine.cli_args) ical_files =
in in
try ListLabels.iter good_rems ~f:(fun rem -> Printf.printf "%s" (Remind.string_of_rem rem)) try ListLabels.iter good_rems ~f:(fun rem -> Printf.printf "%s" (Remind.string_of_rem rem))
with e -> 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 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