Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/mo_config/internal_error.ml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@

(* TODO: replace with Printexc.default_uncaught_exception_handler with OCaml 4.11*)
let default_uncaught_exception_handler exn raw_backtrace =
Printexc.(
Printf.eprintf "Fatal error: exception %s\n" (to_string exn);
print_raw_backtrace stderr raw_backtrace;
flush stderr)

let setup_handler () =
Printexc.record_backtrace true;
Printexc.set_uncaught_exception_handler (fun exn rb ->
let open Printexc in
record_backtrace true;
set_uncaught_exception_handler (fun exn rb ->
Printf.eprintf "OOPS! You've triggered a compiler bug.\n";
Printf.eprintf "Please report this at https://github.com/dfinity/motoko/issues/new with the following details:\n\nMotoko %s\n\n" Source_id.banner;
default_uncaught_exception_handler exn rb
Expand Down