1
0
mirror of synced 2025-12-22 19:34:15 -05:00
Files
docs/lib/handle-exceptions.js
Peter Bengtsson 8eb7898827 send errors to Failbot in SSR rendering (#30153)
* send errors to failbot in SSR rendering

* wip

* progress

* tidying up

* no point awaiting something that doens't return a promise
2022-08-22 16:50:18 +00:00

29 lines
781 B
JavaScript

import FailBot from './failbot.js'
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)
try {
FailBot.report(err)
} catch (failBotError) {
console.warn('Even sending the uncaughtException error to FailBot failed!')
console.error(failBotError)
}
})
process.on('unhandledRejection', async (err) => {
console.error(err)
try {
FailBot.report(err)
} catch (failBotError) {
console.warn('Even sending the unhandledRejection error to FailBot failed!')
console.error(failBotError)
}
})