npm

Check out our latest tech talk, "JavaScript Supply Chain Security" presented by VP of Security, Adam Baldwin.Watch it here »

waterline-to-boom

1.0.0 • Public • Published

waterline-to-boom

Transform waterline errors to Boom errors

Build Status

API

WL2Boom(err, [resourceName], [allowed])

Turns standard WLError, WLUsageError, and WLValidationError Waterline errors into proper Boom errors for use in hapi error handlers. Best used with dogwater.

  • WLError gets wrapped by Boom (status code set in error's code property, error message set in error's reason property).
  • WLUsageError becomes a Boom.badImplementation (500).
  • WLValidationError includes validation errors in a Boom.badData (422).
  • All others become a Boom.badImplementation (500).

Arguments

  • err - the Waterline error
  • resourceName - (optional) the resource name (often a Waterline collection identity). This is used when building WLValidationError into a Boom error.
  • allowed - (optional) an array of allowed attributes. Only validation errors on these attributes will be mentioned in the resulting Boom errors resulting from WLValidationErrors. If not provided, all attributes are fair-game for mentioning.

install

npm i waterline-to-boom

Downloadsweekly downloads

68

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability