Source file error.ml
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
open! Import
include Info0
[@@@warning "-incompatible-with-upstream"]
let t_sexp_grammar : t Sexplib0.Sexp_grammar.t = { untyped = Any "Error.t" }
[%%template
[@@@kind.default k = (value_or_null, base_or_null, bits32 & bits32)]
let[@cold] raise (type a : k) t : a = (raise [@kind k]) (to_exn t)
let[@cold] raise_s (type a : k) sexp : a = (raise [@kind k]) (create_s sexp)
let[@inline always] raise (type a : k) t : a = (raise [@kind k]) t [@nontail]
let[@inline always] raise_s (type a : k) sexp : a = (raise_s [@kind k]) sexp [@nontail]]
let to_info t = t
let of_info t = t
let reraise_uncaught t ~f =
try f () with
| exn ->
let bt = Stdlib.Printexc.get_raw_backtrace () in
Exn.raise_with_original_backtrace
(to_exn (tag_s_lazy (of_exn exn) ~tag:(lazy (sexp_of_t t))))
bt
;;
include%template Pretty_printer.Register_pp [@mode portable] (struct
type nonrec t = t
let module_name = "Base.Error"
let pp = pp
end)