mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
feat(exn_bt): in show/pp, do print the backtrace when present
This commit is contained in:
parent
3a5eaaa44d
commit
2b00a0cea1
1 changed files with 9 additions and 1 deletions
|
|
@ -3,7 +3,15 @@ type t = exn * Printexc.raw_backtrace
|
|||
let[@inline] make exn bt : t = exn, bt
|
||||
let[@inline] exn (e, _) = e
|
||||
let[@inline] bt (_, bt) = bt
|
||||
let show self = Printexc.to_string (exn self)
|
||||
|
||||
let show self =
|
||||
let bt = Printexc.raw_backtrace_to_string (bt self) in
|
||||
let exn = Printexc.to_string (exn self) in
|
||||
if bt = "" then
|
||||
exn
|
||||
else
|
||||
Printf.sprintf "%s\n%s" exn bt
|
||||
|
||||
let pp out self = Format.pp_print_string out (show self)
|
||||
let[@inline] raise (e, bt) = Printexc.raise_with_backtrace e bt
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue