Async Error Catcher for ExpressJS routes
A helper to automatically catch errors thrown within ExpressJS routes and then pass them to the next
function so they can be picked up by your error handler at the end of the stack.
;; const app = ;const router = ; { /* Do something asynchronous */} router; app; /* Error Handler middleware */app;
This also works for any middleware or route function that returns a promise.
For a more detailed breakdown, I've explained a bit more on my blog.
http://madole.xyz/error-handling-in-express-with-async-await-routes/
NOTE: Written in ES6, but compiled back to ES5 with babel