Add Exn.raise_with_backtrace

This commit is contained in:
Rudi Grinberg 2018-04-06 22:26:49 +08:00
parent 10c5447608
commit 52a3833e0e
2 changed files with 12 additions and 0 deletions

View File

@ -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))

View File

@ -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 -> _