1
0
mirror of synced 2025-12-21 19:06:49 -05:00
Files
docs/lib/handle-exceptions.js
Jason Etcovitch b22fe856c8 Report unhandledRejections and uncaughtExceptions to Sentry (#17014)
* Report to Sentry in error handlers

* Support optional metadata
2020-12-16 16:28:25 +00:00

17 lines
472 B
JavaScript

const FailBot = require('./failbot')
process.on('uncaughtException', async err => {
if (err.code === 'MODULE_NOT_FOUND') {
console.error('\n\n🔥 Uh oh! It looks you are missing a required npm module.')
console.error('Please run `npm install` to make sure you have all the required dependencies.\n\n')
}
console.error(err)
await FailBot.report(err)
})
process.on('unhandledRejection', async err => {
console.error(err)
await FailBot.report(err)
})