Commits

Yaron Minsky committed 74fe585

imported patch better-exn-printers

Comments (0)

Files changed (1)

base/core/lib/exn.ml

 
 let protect ~f ~finally = protectx ~f () ~finally
 
-let pp ppf t = Sexp.pp_hum ppf (sexp_of_exn t)
+let pp ppf t =
+  match sexp_of_exn_opt with
+  | Some sexp -> Sexp.pp_hum ppf sexp
+  | None -> Format.fprintf ppf "%s" (Printexc.to_string t)
 
 let backtrace = Printexc.get_backtrace