json-boom

1.0.2 • Public • Published

Installation

npm install --save json-boom

Usage

 
const Boom = require('boom');
const convert = require('json-boom');
 
const err = Boom.notFound('My Error');
const body = convert(err);
 
/* 
{
    errors: [
        {
            errorCode: '404',
            error: 'Not Found',
            message: 'My Error',
            errorData: []
        }
    ]
}
*/
 
const err = Boom.notFound('My Error', 'email');
const body = convert(err);
 
/* 
{
    errors: [
        {
            errorCode: '404',
            error: 'Not Found',
            message: 'My Error',
            errorData: [{field: 'email'}]
        }
    ]
}
*/

Package Sidebar

Install

npm i json-boom

Weekly Downloads

3

Version

1.0.2

License

GPL

Last publish

Collaborators

  • xyrox2