Variant

error

The set of errors which may be raised by functions in this package.

variant error {
  connection-failed(string),
  invalid-params(string),
  invalid-query(string),
  query-failed(db-error),
  value-conversion-failed(string),
  unknown-prepared-statement,
  access-denied,
  timeout,
  other(string),
}

Cases

CasePayloadDescription
connection-failedstringThe host could not establish or maintain a connection to the database. The operation may succeed if retried once the database is reachable.
invalid-paramsstringA query parameter was invalid: the wrong number of parameters, a value whose type does not match the target column, or a value that could not be encoded for the wire protocol.
invalid-querystringThe SQL statement was rejected before it reached the database (e.g. by host-side validation). Statements rejected by the database itself are reported via query-failed instead.
query-faileddb-errorThe database rejected or failed the statement. db-error carries the structured detail (SQLSTATE code, severity, ...); branch on db-error.code to distinguish conditions such as a unique-constraint violation (23505).
value-conversion-failedstringA value returned by the database could not be converted into a pg-value (e.g. an unsupported column type).
unknown-prepared-statementThe prepared-statement token is not recognized: it was never prepared by this component, or has since been evicted.
access-deniedThe requesting component is not permitted to reach the requested database.
timeoutThe operation did not complete within the host- or backend-imposed time limit.
otherstringSome other implementation-specific error has occurred (e.g. I/O). Used for backend-specific failures that do not map to a named case above.