summaryrefslogtreecommitdiffstats
path: root/stdlib/printexc.mli
blob: 0b56bd2a83ad495e24c14a6d9ff98b6411d689ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(* A catch-all exception handler *)

val catch: ('a -> 'b) -> 'a -> 'b
        (* [Printexc.catch fn x] applies [fn] to [x] and returns the result.
           If the evaluation of [fn x] raises any exception, the
           name of the exception is printed on standard error output,
           and the programs aborts with exit code 2.
           Typical use is [Printexc.catch main ()], where [main], with type
           [unit->unit], is the entry point of a standalone program, to catch
           and print stray exceptions. *)

val print: ('a -> 'b) -> 'a -> 'b
        (* Same as [catch], but re-raise the stray exception after
           printing it, instead of aborting the program. *)