diff --git a/src/stdune/exn.ml b/src/stdune/exn.ml index c42025bb..469de331 100644 --- a/src/stdune/exn.ml +++ b/src/stdune/exn.ml @@ -10,3 +10,13 @@ let protectx x ~f ~finally = | exception e -> finally x; raise e let protect ~f ~finally = protectx () ~f ~finally + +include + ((struct + [@@@warning "-32-3"] + let raise_with_backtrace exn _ = reraise exn + include Printexc + let raise_with_backtrace exn bt = raise_with_backtrace exn bt + end) : (sig + val raise_with_backtrace: exn -> Printexc.raw_backtrace -> _ + end)) diff --git a/src/stdune/exn.mli b/src/stdune/exn.mli index c30f0674..6df3fa9f 100644 --- a/src/stdune/exn.mli +++ b/src/stdune/exn.mli @@ -8,3 +8,5 @@ external reraise : exn -> _ = "%reraise" val protect : f:(unit -> 'a) -> finally:(unit -> unit) -> 'a val protectx : 'a -> f:('a -> 'b) -> finally:('a -> unit) -> 'b + +val raise_with_backtrace: exn -> Printexc.raw_backtrace -> _