Module Jsont.Error

Encoding, decoding and query errors.

type kind

The type for kind of errors.

type t = Context.t * Meta.t * kind

The type for errors.

val to_string : t -> string

error_to_string e formats e using pp_error to a string.

val make_msg : Context.t -> Meta.t -> string -> t

make_msg ctx m msg is an error with message msg for meta m in context ctx.

val msg : Context.t -> Meta.t -> string -> 'a

error ctx m msg raises an error with message msg for meta m in context ctx.

val msgf : Context.t -> Meta.t -> ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> 'a

fmt is like msg but formats an error message.

val sort : Context.t -> Meta.t -> exp:Sort.t -> fnd:Sort.t -> 'a

sort p m ~exp ~fnd errors when sort exp was expected but fnd was found. See also Jsont.Repr.type_error

val kind : Context.t -> Meta.t -> exp:string -> fnd:Sort.t -> 'a

error_kind p m ~exp ~fnd errors when kind exp was expected but sort fnd was found. See also Jsont.Repr.type_error.

val miss_mem : ?obj_kind:string -> Context.t -> Meta.t -> exp:string -> fnd:string list -> 'a

miss_mem ctx m ~exp ~fnd errors when a member named exp was expected in an object of kind obj_kind, but the object had only fnd names (leave empty if the info is no longer available).

val unexpected_mems : Context.t -> Meta.t -> obj_kind:string -> mems:string list -> 'a

unexpected_mems ctx m ~obj_kind ~mems errors when an object of kind obj_kind has the mems unexpected member names.

val pp : t fmt

pp_error formats errors.