1.0.0 • Published 9 years ago
waterline-to-boom v1.0.0
waterline-to-boom
Transform waterline errors to Boom errors
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.
WLErrorgets wrapped by Boom (status code set in error'scodeproperty, error message set in error'sreasonproperty).WLUsageErrorbecomes aBoom.badImplementation(500).WLValidationErrorincludes validation errors in aBoom.badData(422).- All others become a
Boom.badImplementation(500).
Arguments
err- the Waterline errorresourceName- (optional) the resource name (often a Waterline collection identity). This is used when buildingWLValidationErrorinto 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 fromWLValidationErrors. If not provided, all attributes are fair-game for mentioning.