Error management

Route's internal middleware stack execution works with Promises.


let error = new TypeError('gets handled asynchronously');

//...
const route = router.buildRoute({/*options*/});

route.main(function(req, res) {
    throw error;
}).catch(TypeError, function(err) {
    err === error; //true
});

All errors which happen in a request lifecycle get eventually processed by internal errorHandler middleware.
Service App can respond with RequestError only thus all other errors which don't extend the RequestError are coerced to meet the condition.
See the bi-service ErrorList.

You can influence the way errors are processed by the following events:

comments powered by Disqus