From 0d325741f4e8e77af889ecda3c1bf1dc735ac485 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 becfbf3b..8ff57668 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