Sys.Signals module for a Variant type of signals (and a set_signal function that...
[ocaml.git] / stdlib / printexc.mli
blob887169c4292c88661467c16b239877f8d519a611
1 (***********************************************************************)
2 (* *)
3 (* Objective Caml *)
4 (* *)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
6 (* *)
7 (* Copyright 1996 Institut National de Recherche en Informatique et *)
8 (* en Automatique. All rights reserved. This file is distributed *)
9 (* under the terms of the GNU Library General Public License, with *)
10 (* the special exception on linking described in file ../LICENSE. *)
11 (* *)
12 (***********************************************************************)
14 (* $Id$ *)
16 (** Facilities for printing exceptions. *)
18 val to_string : exn -> string
19 (** [Printexc.to_string e] returns a string representation of
20 the exception [e]. *)
22 val print : ('a -> 'b) -> 'a -> 'b
23 (** [Printexc.print fn x] applies [fn] to [x] and returns the result.
24 If the evaluation of [fn x] raises any exception, the
25 name of the exception is printed on standard error output,
26 and the exception is raised again.
27 The typical use is to catch and report exceptions that
28 escape a function application. *)
30 val catch : ('a -> 'b) -> 'a -> 'b
31 (** [Printexc.catch fn x] is similar to {!Printexc.print}, but
32 aborts the program with exit code 2 after printing the
33 uncaught exception. This function is deprecated: the runtime
34 system is now able to print uncaught exceptions as precisely
35 as [Printexc.catch] does. Moreover, calling [Printexc.catch]
36 makes it harder to track the location of the exception
37 using the debugger or the stack backtrace facility.
38 So, do not use [Printexc.catch] in new code. *)