Hapi plugin to transform application errors into boom error responses. Where each key in the errors object corresponds with a matching boom method.
var hapi = ;var boomstick = ;var server = ;server;server;
success: A checkFunction that is executed before all of the potential error cases. If the success case is matched the errors checks are bypassed entirely.
'errors': An Object that contains a key for each boom method you want returned, along with a matching checkFunction for determining when that error case has occured. Each key in the errors object needs to exactly match the name of the boom method that you want executed.
'checkFunction': - A function that returns a boolean and has access to the Hapi request object, for error cases it should return true if that boom error should be generated.
'metadataKey': - A string denoting a key name, if the source
Error has a value for that key it will be copied into the final error response. (Default: 'expose')
Boomstick is attached at the onPostHandler point of the Hapi request lifecycle. In the event that the function in the options.success object returns true boomstick will pass the request through untouched. If success returns false each of the other cases is checked and when one is true a boom error is generated and passed into your reply. If none of the errors are matched the request is passed through untouched.