package caqti
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=bc67a61e9c43f1cd9ab54476bdd4ea6495decd281aececcb4062c29713a7391d
sha512=17018a142bd29be3b503c6b6f5320ec65b3418a46bb82c0127f5ff198890d56bd9e50263ce20930e8c6e0dadb8bdf5f43b6479fc111948d44e3170715e40c290
doc/caqti/Caqti_error/index.html
Module Caqti_error
Source
Error descriptors.
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
.
Messages with Metadata
Note. Please consider the fields internal for now, they may still be revised or hidden.
Documented Constructors
Errors during Driver Loading
load_rejected ~uri msg
indicates that a driver 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 client library.
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 could not be transmitted to the database, that the database was not ready to process the request, or that something went wrong while processing the request.
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.
Specific Error 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
]
Generic Error Type and Functions
pp ppf error
prints an explanation of error
on ppf
.