Library
Module
Module type
Parameter
Class
Class type
Error descriptors.
In this type, drivers can stash information about an errors in ther own format, which can later be used for pretty-printing and or future operations. Drivers must define_msg
on each constructor added to this type.
val define_msg :
pp:(Format.formatter -> msg -> unit) ->
extension_constructor ->
unit
Mandatory registration of pretty-printer for a driver-supplied error descriptor.
val pp_msg : Format.formatter -> msg -> unit
pp_msg ppf msg
formats msg
on ppf
.
Note. Please consider the fields internal for now, they may still be revised or hidden.
val load_rejected : uri:Uri.t -> msg -> [> `Load_rejected of load_error ]
load_rejected ~uri msg
indicates that the driver to load could not be identified from uri
.
val load_failed : uri:Uri.t -> msg -> [> `Load_failed of load_error ]
load_failed ~uri msg
indicates that a driver for uri
could not be loaded.
val connect_rejected :
uri:Uri.t ->
msg ->
[> `Connect_rejected of connection_error ]
connect_rejected ~uri msg
indicates that the driver rejected the URI.
val connect_failed :
uri:Uri.t ->
msg ->
[> `Connect_failed of connection_error ]
connect_failed ~uri msg
indicates that the driver failed to establish a connection to the database.
val encode_missing :
uri:Uri.t ->
field_type:'a Caqti_type.field ->
unit ->
[> `Encode_rejected of coding_error ]
encode_missing ~uri ~field_type ()
indicates that the driver does not support field_type
and no fallback encoding is available for the type.
val encode_rejected :
uri:Uri.t ->
typ:'a Caqti_type.t ->
msg ->
[> `Encode_rejected of coding_error ]
encode_rejected ~uri ~typ msg
indicates that encoding a value to typ
failed, e.g. due to being out of range.
val encode_failed :
uri:Uri.t ->
typ:'a Caqti_type.t ->
msg ->
[> `Encode_failed of coding_error ]
encode_failed ~uri ~typ msg
indicates that a parameter of type typ
was not accepted by the database driver.
val request_rejected :
uri:Uri.t ->
query:string ->
msg ->
[> `Request_rejected of query_error ]
request_rejected ~uri ~query msg
indicates that query
was not accepted by the database or driver.
val request_failed :
uri:Uri.t ->
query:string ->
msg ->
[> `Request_failed of query_error ]
request_failed ~uri ~query msg
indicates that the request to could not be transmitted to the database, that the database was not ready to process the request, or that something went wrong while the request was being processed.
val decode_missing :
uri:Uri.t ->
field_type:'a Caqti_type.field ->
unit ->
[> `Decode_rejected of coding_error ]
decode_missing ~uri ~field_type ()
indicates that the driver does not support field_type
for decoding result rows.
val decode_rejected :
uri:Uri.t ->
typ:'a Caqti_type.t ->
msg ->
[> `Decode_rejected of coding_error ]
decode_rejected ~uri ~typ msg
indicates that the driver could not decode a field of type typ
from the returned row, e.g. due to an invalid value or limited range of the target type.
val response_failed :
uri:Uri.t ->
query:string ->
msg ->
[> `Response_failed of query_error ]
response_failed ~uri ~query msg
indicates that something when wrong while fetching a delayed part of the response.
val response_rejected :
uri:Uri.t ->
query:string ->
msg ->
[> `Response_rejected of query_error ]
response_rejected ~uri ~query msg
indicates that the response from the database was rejected due to requirements posed by client code.
type call = [
| `Encode_rejected of coding_error
| `Encode_failed of coding_error
| `Request_rejected of query_error
| `Request_failed of query_error
| `Response_rejected of query_error
]
type retrieve = [
| `Decode_rejected of coding_error
| `Response_failed of query_error
| `Response_rejected of query_error
]
type connect = [
| `Connect_rejected of connection_error
| `Connect_failed of connection_error
| `Post_connect of call_or_retrieve
]
val pp : Format.formatter -> [< t ] -> unit
pp ppf error
prints an explanation of error
on ppf
.
val show : [< t ] -> string
show error
is an explanation of error
.
exception Exn of t
Exn error
can be used when an exception is preferred over explicit error handling. The core Caqti API never raises exceptions which originate from runtime errors.