class PG::ServerError < PG::Error

An error the server reported (an ErrorResponse message): a failed statement, or a refused login. Its fields are the protocol's, by their one-letter codes; the common ones have readers.

src/errors.qz:10

Class methods

def self.new(fields: Hash[String, String]) -> PG::ServerError

An error with the server's fields.

src/errors.qz:14

def self.describe(fields: Hash[String, String]) -> String

ERROR 23505: duplicate key value ..., with the detail on a line of its own.

PG::ServerError.describe({ "V" => "ERROR", "C" => "42P01", "M" => "no table" })   # => "ERROR 42P01: no table"

src/errors.qz:47

Methods

def fields -> Hash[String, String]

All the fields, by their codes (S severity, C SQLSTATE, M message, D detail, H hint, P position, W where, s schema, t table, c column, n constraint, ...).

src/errors.qz:21

def code -> String

The SQLSTATE code (23505 for a unique violation).

src/errors.qz:24

def severity -> String

ERROR, FATAL or PANIC (not localized).

src/errors.qz:27

def detail -> String?

The detail, if the server gave one.

src/errors.qz:30

def hint -> String?

The hint, if the server gave one.

src/errors.qz:33

def position -> Int?

Where in the statement the error is: a character position from 1.

src/errors.qz:36

def constraint -> String?

The constraint violated, if any.

src/errors.qz:39