Dr. Boom: Postgres
Auto-cast errors from pg
into Hapi HTTP Errors.
Example / Boilerplate
Plugin registration boilerplate:
var hapi = ;var config = ;var Boom = ; var server = ;server; server
Now, you can pass your postgres errors right on through to hapi reply!
{ pg;});
Options
getNull404: Boolean. If the handler request method is GET, and postgres doesn't pass a result, throw a 404 Not Found error regardless of there not being a postgres error. Default: False
extendConditions: Object. Keys of postgres error codes, mapped to functions that return Boom objects.
extendCategories: Object. Keys of the first 2 digits of error codes, mapped to functions that return Boom objects.
Default Conditions and Categories
var condition = { return Boom; } { return Boom; } var category = { return Boom; } { return Boom; } { return Boom; } { return Boom; }
I'll gladly accept pull requests!