File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ module.exports = class FailBot {
7676 * @param {Error } error
7777 * @param {any } metadata
7878 */
79- async sendException ( error , metadata ) {
79+ async sendException ( error , metadata = { } ) {
8080 const data = Object . assign ( { app : this . app } , this . getFailbotContext ( ) , metadata )
8181 const body = this . formatJSON ( error , Object . assign ( { app : this . app } , data ) )
8282
Original file line number Diff line number Diff line change 1- process . on ( 'uncaughtException' , err => {
1+ const FailBot = require ( './failbot' )
2+
3+ process . on ( 'uncaughtException' , async err => {
24 if ( err . code === 'MODULE_NOT_FOUND' ) {
35 console . error ( '\n\n🔥 Uh oh! It looks you are missing a required npm module.' )
46 console . error ( 'Please run `npm install` to make sure you have all the required dependencies.\n\n' )
57 }
68
79 console . error ( err )
10+ await FailBot . report ( err )
11+ } )
12+
13+ process . on ( 'unhandledRejection' , async err => {
14+ console . error ( err )
15+ await FailBot . report ( err )
816} )
You can’t perform that action at this time.
0 commit comments