mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2026-01-29 04:14:51 -05:00
Don't use raise_with_backtrace in backward-compatible Fun.protect
This commit is contained in:
parent
f759a92214
commit
6a51830305
2 changed files with 4 additions and 6 deletions
|
|
@ -58,8 +58,8 @@ let shims_fun_mli_pre_408 =
|
||||||
(** This is the [Fun] module distributed with the OCaml Core system.
|
(** This is the [Fun] module distributed with the OCaml Core system.
|
||||||
It is linked with containers in case the installed OCaml system does not
|
It is linked with containers in case the installed OCaml system does not
|
||||||
provide a compatible [Fun] module.
|
provide a compatible [Fun] module.
|
||||||
It is the an unmodified version of [Fun] as shipped with the OCaml core
|
It is the a slightly modified version of [Fun] as shipped with the OCaml
|
||||||
system.
|
core system.
|
||||||
*)
|
*)
|
||||||
"
|
"
|
||||||
^ read_file "stdlib/fun.mli"
|
^ read_file "stdlib/fun.mli"
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,10 @@ exception Finally_raised of exn
|
||||||
let protect ~(finally : unit -> unit) work =
|
let protect ~(finally : unit -> unit) work =
|
||||||
let finally_no_exn () =
|
let finally_no_exn () =
|
||||||
try finally () with e ->
|
try finally () with e ->
|
||||||
let bt = Printexc.get_raw_backtrace () in
|
raise (Finally_raised e)
|
||||||
Printexc.raise_with_backtrace (Finally_raised e) bt
|
|
||||||
in
|
in
|
||||||
match work () with
|
match work () with
|
||||||
| result -> finally_no_exn () ; result
|
| result -> finally_no_exn () ; result
|
||||||
| exception work_exn ->
|
| exception work_exn ->
|
||||||
let work_bt = Printexc.get_raw_backtrace () in
|
|
||||||
finally_no_exn () ;
|
finally_no_exn () ;
|
||||||
Printexc.raise_with_backtrace work_exn work_bt
|
raise work_exn
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue