Exception: PG::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/tep/pg.rb

Overview

PG::Error hierarchy -- ruby-pg-shape, SQLSTATE-keyed. AR's pg adapter does e.is_a?(PG::UniqueViolation) to translate libpq errors; the class identity has to match. Live since matz/spinel#627 (rescue ParentClass + is_a?(ParentClass) walk the class hierarchy).

Raised by Connection#exec / #exec_params via the two-arg raise PG::Klass, msg form (spinel can't lower raise X.new(msg, ...) for custom Exception initializers -- matz/spinel#622). SQLSTATE / result-handle context lives on conn.last_sqlstate / #last_error_message / #last_result_rh for callers who need them post-rescue.