package caqti
Install
Dune Dependency
Authors
Maintainers
Sources
md5=1dbae4092760be0813823a1936dec1c6
sha256=9635da1efb377fc4477a573f8292d4afd781e20dae17e2da7250dc7fbfec5170
doc/caqti/Caqti_error/index.html
Module Caqti_error
Source
Error descriptors.
Error Messages
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.
Mandatory registration of pretty-printer for a driver-supplied error descriptor.
pp_msg ppf msg
formats msg
on ppf
.
Error Records
Note. Please consider the fields internal for now, they may still be revised or hidden.
Errors during Driver Loading
load_rejected ~uri msg
indicates that the driver to load could not be identified from uri
.
load_failed ~uri msg
indicates that a driver for uri
could not be loaded.
Errors during Connect
connect_rejected ~uri msg
indicates that the driver rejected the URI.
connect_failed ~uri msg
indicates that the driver failed to establish a connection to the database.
Errors during Call
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.
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.
Errors during Result Retrieval
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.
Error Sub-Types
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
]
Error Type and Functions
pp ppf error
prints an explanation of error
on ppf
.