module

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

connection_failed(ex : DB::ConnectionRefused, server : String) : PluginResult

"Could not connect to the PostgreSQL server: ..." shape.

Source
query_failed(ex : Exception, server : String) : PluginResult

"PostgreSQL error: ..." / "MySQL error: ..." shape - for the dialect's own query-error exception raised mid-session.

Source