1Printexc(3)                      OCaml library                     Printexc(3)
2
3
4

NAME

6       Printexc - Facilities for printing exceptions.
7

Module

9       Module   Printexc
10

Documentation

12       Module Printexc
13        : sig end
14
15
16       Facilities for printing exceptions.
17
18
19
20
21
22
23
24       val to_string : exn -> string
25
26
27       Printexc.to_string e returns a string representation of the exception e
28       .
29
30
31
32
33       val print : ('a -> 'b) -> 'a -> 'b
34
35
36       Printexc.print fn x applies fn to x and returns  the  result.   If  the
37       evaluation  of  fn x raises any exception, the name of the exception is
38       printed on standard error output, and the exception  is  raised  again.
39       The  typical  use is to catch and report exceptions that escape a func‐
40       tion application.
41
42
43
44
45       val catch : ('a -> 'b) -> 'a -> 'b
46
47
48       Printexc.catch fn x is similar to Printexc.print , but aborts the  pro‐
49       gram  with  exit  code  2  after printing the uncaught exception.  This
50       function is deprecated:  the  runtime  system  is  now  able  to  print
51       uncaught  exceptions  as  precisely  as Printexc.catch does.  Moreover,
52       calling Printexc.catch makes it harder to track  the  location  of  the
53       exception  using  the debugger or the stack backtrace facility.  So, do
54       not use Printexc.catch in new code.
55
56
57
58
59
60
61OCamldoc                          2007-05-24                       Printexc(3)
Impressum