Jsont.Error
Encoding, decoding and query errors.
val kind_to_string : kind -> string
kind_to_string kind
is kind
as a string.
module Context : sig ... end
JSON error contexts.
The type for errors. The context, the error localisation and the kind of error.
make_msg ctx meta msg
is an error with message msg
for meta meta
in context ctx
.
val msg : Meta.t -> string -> 'a
msg meta msg
raises an error with message msg
for meta meta
in an empty context.
val msgf :
Meta.t ->
('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 ->
'a
msgf meta fmt …
is like msg
but formats an error message.
push_array kinded_sort n e
contextualises e
as an error in the n
th element of an array kinded sort kinded_sort
.
push_object kinded_sort n e
contextualises e
as an error in the member n
of an object of kinded sort kinded_sort
.
val puterr : unit fmt
puterr
formats Error:
in red.
val missing_mems :
Meta.t ->
kinded_sort:string ->
exp:string list ->
fnd:string list ->
'a
missing_mems ctx m ~object_kind ~exp ~mems
errors when member named exp
were expected in an object of kind object_kind
with metadata meta
but the object had only fnd
names (leave empty if the info is no longer available). m
's location should span the object.