1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
let pp_exception f = function
| Exit -> Format.pp_print_string f "Exit"
| Not_found -> Format.pp_print_string f "Not_found"
| Arg.Bad x -> Format.fprintf f "Arg.Bad(%s)" x
| Sys.Break -> Format.pp_print_string f "Sys.Break"
| Stack.Empty -> Format.pp_print_string f "Stack.Empty"
| Queue.Empty -> Format.pp_print_string f "Queue.Empty"
| Stream.Error x -> Format.fprintf f "Stream.Error %s" x
| Stream.Failure -> Format.pp_print_string f "Stream.Failure"
| Arg.Help x -> Format.fprintf f "Arg.Help(%s)" x
| Parsing.Parse_error -> Format.pp_print_string f "Parsing.Parse_error"
| Scanf.Scan_failure x -> Format.fprintf f "Scanf.Scan.failure(%s)" x
| Lazy.Undefined -> Format.pp_print_string f "Lazy.Undefined"
| UnixLabels.Unix_error (er, x, y) ->
Format.fprintf f "UnixLabels.Unix_error(%s,%s,%s)"
(UnixLabels.error_message er)
x y
| Unix.Unix_error (er, x, y) ->
Format.fprintf f "Unix.Unix_error(%s,%s,%s)" (Unix.error_message er) x y
| Failure x -> Format.fprintf f "Failure(%s)" x
| Stack_overflow -> Format.pp_print_string f "Stack_overflow"
| exc -> Format.pp_print_string f (Printexc.to_string exc)