drboom-tedius

Catches tedious errors and converts them into Hapi Boom errors.

Usage no npm install needed!

<script type="module">
  import drboomTedius from 'https://cdn.skypack.dev/drboom-tedius';
</script>

README

Dr. Boom: Seaquell

npm i drboom-tedious

Auto-cast errors from tedious into Hapi HTTP Errors.

Example / Boilerplate

Plugin registration boilerplate:

var hapi = require('hapi');
var config = require('./config.json');
var Boom = require('boom');

var server = new hapi.Server();
server.connection(config);

server.register([{
    register: require('drboom')(),
    options: {
        plugins: [require('drboom-tedious')()]
    },
}, function (err) {
    server.log(['startup'], 'Loaded pgboom plugin');
    server.start(function (err) {
        //...
    }
});

Now, you can pass your tedious errors right on through to hapi reply!

function someHandler(request, reply) {
    mssql.query("some query", reply);
});