package postgres_async
Module Postgres_async.Pgasync_errorSource
The type Pgasync_error.t is used for all errors in this library.
to_error returns a regular Core.Error.t that fully describes what went wrong (including but not limited to a postgres error code, if we hae one), and if you only need to show the error to someone/raise/fail then using that completely suffices.
_If_ the error due to an ErrorResponse from the server _and_ we successfully parsed an error code out of it, you can retrieve that via postgres_error_code.
Note that either of those conditions might be false, e.g. the error might be due to TCP connection failure, so we certainly won't have any postgres error code; you shouldn't take the name of the type to mean "postgres error", rather "postgres async error"---any error this library can produce.