baboom
v0.1.7
Published
Simple way to use custom Boom errors
Downloads
9
Readme
baboom
Baboom is a wrapper for the Boom error library which simplifies the delivery of custom payloads. Rather than a message and data object, you can simply pass the payload to the constructor, or to one of Boom's static constructor methods.
##Constructor Example
const Baboom = require('baboom');
throw new Baboom({
someKey: 'customValue',
someData: {
someBool: false
}
}, {
statusCode: 502
});
##Static Example
const Baboom = require('baboom');
throw Baboom.internal({
message: 'If a message property is provided, it will also be used in constructed the Error object',
someValue: 'The payload you specify here will be the exact JSON output.',
someArray: [1,2,3,4]
});