(*--------------------------------------------------------------------------- Copyright (c) 2026 Thomas Gazagnaire. All rights reserved. SPDX-License-Identifier: ISC ---------------------------------------------------------------------------*) (** JSONB errors: {!Catalog.Error.Runtime} errors in sqlite3's words. Each error has a builder and a [fail_] twin that raises it. *) type t = Catalog.Error.t (** The type for errors, {!Catalog.Error.t}. *) val pp : t Fmt.t (** [pp] is {!Catalog.Error.pp}. *) val malformed : t (** [malformed] is ["malformed JSON"]. *) val fail_malformed : unit -> 'a (** [fail_malformed ()] raises {!malformed}. *) val too_deep : t (** [too_deep] is ["JSON nested too deep"]: more than 1000 nested arrays and objects. *) val fail_too_deep : unit -> 'a (** [fail_too_deep ()] raises {!too_deep}. *) (** The type for the ways a path fails. *) type path = | Bad_path (** The path is not one SQLite's syntax spells. *) | Not_array_element (** An array insertion names something that is not an array element. *) | Path_too_deep (** The path goes past 1000 levels. *) | Malformed (** The document is malformed where the path goes. *) val path : path -> string -> t (** [path p text] is the error for the path [text] failing as [p], in jsonBadPathError's words: ["bad JSON path: 'p'"], ["not an array element: 'p'"], ["JSON path too deep"] or ["malformed JSON"]. *) val fail_path : path -> string -> 'a (** [fail_path p text] raises [path p text]. *) val sort : exp:string -> fnd:Jsonb_sort.t option -> t (** [sort ~exp ~fnd] is the error for a codec expecting [exp] and finding an element of type [fnd], [None] for a reserved type. *) val fail_sort : exp:string -> fnd:Jsonb_sort.t option -> 'a (** [fail_sort ~exp ~fnd] raises [sort ~exp ~fnd]. *) val no_encoder : string -> t (** [no_encoder kind] is the error for encoding with a codec of [kind] that only decodes. *) val fail_no_encoder : string -> 'a (** [fail_no_encoder kind] raises [no_encoder kind]. *) val no_decoder : string -> t (** [no_decoder kind] is the error for decoding with a codec of [kind] that only encodes. *) val fail_no_decoder : string -> 'a (** [fail_no_decoder kind] raises [no_decoder kind]. *)