From 6a0d58e6e0bd2e05c73de84ea4c8b84a0691c2e0 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 1 Apr 2024 12:54:05 -0400 Subject: [PATCH] add Exn_bt.pp --- src/core/exn_bt.ml | 1 + src/core/exn_bt.mli | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/core/exn_bt.ml b/src/core/exn_bt.ml index b69f6614..dc1fab0f 100644 --- a/src/core/exn_bt.ml +++ b/src/core/exn_bt.ml @@ -13,6 +13,7 @@ let[@inline] get_callstack n exn = make exn bt let show self = Printexc.to_string (fst self) +let pp out self = Format.pp_print_string out (show self) let[@inline] raise self = Printexc.raise_with_backtrace (exn self) (bt self) type nonrec 'a result = ('a, t) result diff --git a/src/core/exn_bt.mli b/src/core/exn_bt.mli index 252b7548..eb8f1b02 100644 --- a/src/core/exn_bt.mli +++ b/src/core/exn_bt.mli @@ -22,4 +22,6 @@ val raise : t -> 'a val show : t -> string (** Simple printing *) +val pp : Format.formatter -> t -> unit + type nonrec 'a result = ('a, t) result