module Error: Error
include Info
val raise : t -> 'a
val failwiths : string -> 'a -> ('a -> Sexplib.Sexp.t) -> 'b
failwiths message value sexp_of_value
raises an exception with the supplied
message
and value
, by constructing an Error.t
and using Error.raise
. As
usual, the sexp_of_value
is only applied when the value is converted to a sexp or a
string. So, if you mutate value
in between the time you call failwiths
and the
time the error is displayed, those mutations will be reflected in the error message.
failwiths s a f
= Error.raise (Error.create s a f)
failwithp _here_ s a f
is just failwiths
with the source code position tagged on.
We use Lexing.position
rather than Source_code_position.t
to avoid a circular
dependency.
val failwithp : Lexing.position -> string -> 'a -> ('a -> Sexplib.Sexp.t) -> 'b