|
|
@ -148,14 +148,13 @@ module Invariant = struct
|
|
|
|
{pos_fname: string; pos_lnum: int; pos_bol: int; pos_cnum: int}
|
|
|
|
{pos_fname: string; pos_lnum: int; pos_bol: int; pos_cnum: int}
|
|
|
|
[@@deriving sexp_of]
|
|
|
|
[@@deriving sexp_of]
|
|
|
|
|
|
|
|
|
|
|
|
exception Violation of exn * Printexc.raw_backtrace * position * Sexp.t
|
|
|
|
exception Violation of exn * position * Sexp.t
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
register_sexp_of_exn
|
|
|
|
register_sexp_of_exn
|
|
|
|
(Violation
|
|
|
|
(Violation (Not_found, Lexing.dummy_pos, Sexp.List []))
|
|
|
|
(Not_found, Printexc.get_callstack 1, Lexing.dummy_pos, Sexp.List []))
|
|
|
|
|
|
|
|
(function
|
|
|
|
(function
|
|
|
|
| Violation (exn, _, pos, payload) ->
|
|
|
|
| Violation (exn, pos, payload) ->
|
|
|
|
Sexp.List
|
|
|
|
Sexp.List
|
|
|
|
[ Atom "Invariant.Violation"
|
|
|
|
[ Atom "Invariant.Violation"
|
|
|
|
; sexp_of_exn exn
|
|
|
|
; sexp_of_exn exn
|
|
|
@ -168,7 +167,7 @@ module Invariant = struct
|
|
|
|
( try f ()
|
|
|
|
( try f ()
|
|
|
|
with exn ->
|
|
|
|
with exn ->
|
|
|
|
let bt = Printexc.get_raw_backtrace () in
|
|
|
|
let bt = Printexc.get_raw_backtrace () in
|
|
|
|
let exn = Violation (exn, bt, here, sexp_of_t t) in
|
|
|
|
let exn = Violation (exn, here, sexp_of_t t) in
|
|
|
|
Printexc.raise_with_backtrace exn bt ) ;
|
|
|
|
Printexc.raise_with_backtrace exn bt ) ;
|
|
|
|
true )
|
|
|
|
true )
|
|
|
|
|
|
|
|
|
|
|
@ -181,13 +180,13 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
(** Failures *)
|
|
|
|
(** Failures *)
|
|
|
|
|
|
|
|
|
|
|
|
exception Replay of exn * Printexc.raw_backtrace * Sexp.t
|
|
|
|
exception Replay of exn * Sexp.t
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
register_sexp_of_exn
|
|
|
|
register_sexp_of_exn
|
|
|
|
(Replay (Not_found, Printexc.get_callstack 1, Sexp.List []))
|
|
|
|
(Replay (Not_found, Sexp.List []))
|
|
|
|
(function
|
|
|
|
(function
|
|
|
|
| Replay (exn, _, payload) ->
|
|
|
|
| Replay (exn, payload) ->
|
|
|
|
Sexp.List [Atom "Replay"; sexp_of_exn exn; payload]
|
|
|
|
Sexp.List [Atom "Replay"; sexp_of_exn exn; payload]
|
|
|
|
| exn -> Sexp.Atom (Printexc.to_string exn) )
|
|
|
|
| exn -> Sexp.Atom (Printexc.to_string exn) )
|
|
|
|
|
|
|
|
|
|
|
|