Module Exn
module Exn: Exn
type
t = exn
include Pretty_printer.S
exception Finally of t * t
Raised when finalization after an exception failed, too.
The first exception argument is the one raised by the initial
function, the second exception the one raised by the finalizer.
exception Reraised of string * t
val reraise : t -> string -> 'a
val reraisef : t -> ('a, unit, string, unit -> 'b) Pervasives.format4 -> 'a
val to_string : t -> string
val sexp_of_t : t -> Sexplib.Sexp.t
val protectx : f:('a -> 'b) -> 'a -> finally:('a -> unit) -> 'b
Executes f
and afterwards executes finally
, whether f
throws an exception or
not.
val protect : f:(unit -> 'a) -> finally:(unit -> unit) -> 'a
val handle_uncaught : exit:bool -> (unit -> unit) -> unit
handle_uncaught ~exit f
catches an exception escaping f
and prints an error
message to stderr. Exits with return code 1 if exit
is true
. Otherwise returns
unit.
val handle_uncaught_and_exit : (unit -> Never_returns.never_returns) -> Never_returns.never_returns
behaves as handle_uncaught ~exit:true
and also has a more precise
type in this case
val reraise_uncaught : string -> (unit -> 'a) -> 'a
val backtrace : unit -> string
Printexc.get_backtrace
val sexp_of_t : t -> Sexplib.Sexp.t
Raised when finalization after an exception failed, too.
The first exception argument is the one raised by the initial
function, the second exception the one raised by the finalizer.
Executes f
and afterwards executes finally
, whether f
throws an exception or
not.
handle_uncaught ~exit f
catches an exception escaping f
and prints an error
message to stderr. Exits with return code 1 if exit
is true
. Otherwise returns
unit.
behaves as handle_uncaught ~exit:true
and also has a more precise
type in this case
Printexc.get_backtrace