Skip to content

Instantly share code, notes, and snippets.

@csakis
Last active January 16, 2018 23:48
Show Gist options
  • Save csakis/0ee7d9d93a5351b523ce3bd60f7481b7 to your computer and use it in GitHub Desktop.
Save csakis/0ee7d9d93a5351b523ce3bd60f7481b7 to your computer and use it in GitHub Desktop.
onPreresponse interception of the response
server.ext('onPreResponse', function (request, h) {
const response = request.response;
// if there's no Boom error, don't bother checking further down
if (!response.isBoom) {
return h.continue;
}
//let's handle login POST error
if (request.route.path == '/login' && request.route.method == 'post') {
//business logic comes here to extract the errors from response.details
return h.view('login', {
error: loginError
});
}
return h.continue;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment