Exception: Pgbus::Error

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

Overview

Error-hierarchy policy (the 1.0 contract, issue #282):

* OPERATIONAL errors — a pgbus subsystem failed to do its job at runtime
(bad configuration, a pool that's shutting down, a batch enqueue that
came back short, a rejected GlobalID, a missing PGMQ version) — descend
from Pgbus::Error. `rescue Pgbus::Error` is meant to catch every one of
them; that is the whole point of the hierarchy.

* ARGUMENT-SHAPE errors — the caller handed a method a malformed argument
(a stream name too long for the queue-name budget, an unparseable
cursor, a capsule DSL line that doesn't parse) — stay ArgumentError
subclasses. That's what ArgumentError means, and rescuing it is the
caller's responsibility, not an operational concern. These live in
their own files: Streams::StreamNameTooLong, Streams::Cursor::InvalidCursor,
Configuration::CapsuleDSL::ParseError.

When adding a new error class, decide which half it belongs to and parent it accordingly — do not default to StandardError.