Krikri::PluginHelpers::DbErrors
Shared PluginResult construction for the DB-family plugins' connection/query failure rescues (mysql_, postgresql_). The rescue CLAUSES must stay per-plugin (Crystal needs the concrete exception type at each site: DB::ConnectionRefused, PQ::PQError, MySql::Connection::PacketError), but the message shapes were seven hand-copied pairs - a format tweak (adding rc, redacting a URI) had to land seven times. One implementation now.
Class methods
"Could not connect to the PostgreSQL server: ..." shape.
community.postgresql's connect_to_db() wraps every failed connect in module.fail_json(msg="unable to connect to database: %s"), where the detail is libpq's own connection-error text - not anything Crystal words itself. The plugin's raw params hash is passed so the message can quote the host/port or socket path the plugin actually dialed.