Install a pretty printer for the Fun.Finally_raised exception (#9266)

master
Guillaume Munch-Maccagnoni 2020-04-13 19:09:47 +02:00 committed by GitHub
parent 2208a4cbe6
commit b1fdc44547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -119,6 +119,10 @@ Working version
- #9365: Set.filter_map and Map.filter_map
(Gabriel Scherer, review by Stephen Dolan and Nicolás Ojeda Bär)
- #9266: Install pretty-printer for the exception Fun.Finally_raised.
(Guillaume Munch-Maccagnoni, review by Daniel Bünzli, Gabriel Radanne,
and Gabriel Scherer)
### Other libraries:
- #9106: Register printer for Unix_error in win32unix, as in unix.

View File

@ -20,6 +20,10 @@ let negate p v = not (p v)
exception Finally_raised of exn
let () = Printexc.register_printer @@ function
| Finally_raised exn -> Some ("Fun.Finally_raised: " ^ Printexc.to_string exn)
| _ -> None
let protect ~(finally : unit -> unit) work =
let finally_no_exn () =
try finally () with e ->