File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -76,12 +76,19 @@ let print_marktrace oc e =
7676 Printf. fprintf oc " Marked with %s\n " (mark_to_string m)
7777 ) ms
7878
79+ let print_innermost_mark oc e =
80+ match find_marks e with
81+ | m :: _ -> Printf. fprintf oc " Marked with %s\n " (mark_to_string m)
82+ | [] -> ()
83+
7984let () =
8085 Printexc. set_uncaught_exception_handler (fun e bt ->
8186 (* Copied & modified from Printexc.default_uncaught_exception_handler. *)
8287 Printf. eprintf " Fatal error: exception %s\n " (Printexc. to_string e); (* nosemgrep: print-not-logging *)
8388 if Printexc. backtrace_status () then
84- print_marktrace stderr e;
89+ print_marktrace stderr e
90+ else
91+ print_innermost_mark stderr e;
8592 Printexc. print_raw_backtrace stderr bt;
8693 flush stderr
8794 )
Original file line number Diff line number Diff line change @@ -32,5 +32,10 @@ val print_marktrace: out_channel -> exn -> unit
3232
3333 Used by default for uncaught exceptions. *)
3434
35+ val print_innermost_mark : out_channel -> exn -> unit
36+ (* * Print innermost mark of an exception.
37+
38+ Used by default for uncaught exceptions. *)
39+
3540val find_marks : exn -> mark list
3641(* * Find all marks of an exception. *)
You can’t perform that action at this time.
0 commit comments