sailor-errorify
v1.2.2
Published
Normalize Error for Sailor
Downloads
7
Readme
Errorify for Sailor
Error normalizer for Sailor. Extend express-validator-errors interface.
Install
npm install sailor-errorify
Usage
errorify = require 'sailor-errorify'
or using sailor
dependency
sailor = require 'sailorjs'
errorify = sailor.errorify
API
Ideal for response with error schema, for example:
unless user
return errorify
.add 'identifier', translate.get('User.NotFound'), user
.end res, 'notFound'
In this case return a notFound
response:
{
"errors": [
{
"param": "identifier",
"msg": "Identifier doesn't found"
}
]
}
License
MIT © Kiko Beats