baboom

0.1.7 • Public • Published

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]
});

Readme

Keywords

none

Package Sidebar

Install

npm i baboom

Weekly Downloads

0

Version

0.1.7

License

MIT

Unpacked Size

32.2 kB

Total Files

6

Last publish

Collaborators

  • flagpoonage