Source file code_error.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
type t =
{ message : string
; data : (string * Dyn.t) list
}
exception E of t
let raise message data =
raise (E { message; data })
let to_dyn { message; data } : Dyn.t =
Tuple
[ String message
; Record data
]
let () =
Printexc.register_printer (function
| E t -> Some (Dyn.to_string (to_dyn t))
| _ -> None)