I'm using ES6 in Node.js and want to handle uncaughtException and unhandledRejection using express-async-errors. Documentation say that I should only require module, but what should I do with ES6?
// require('express-async-errors');
import expressAsyncErrors from 'express-async-errors';
Actually I want to handle errors using winston and with express-async-errors I want to handle uncought and unhandled errors. So how can I use it?
express-async-errors
patches express
package when it's imported.
In case it's imported like
import expressAsyncErrors from 'express-async-errors';
and expressAsyncErrors
isn't used, unused import can be dropped, depending on ES module implementation. In order to just import the package, it should be:
import 'express-async-errors';