rollbar / rollbar.js

Error tracking and logging from Javascript to Rollbar
https://docs.rollbar.com/docs/javascript
MIT License
571 stars 213 forks source link

fix: exit server after reconfiguring #1102

Open alecgibson opened 1 year ago

alecgibson commented 1 year ago

Description of the change

According to the docs, exitOnUncaughtException should:

Exit the process after handling an uncaught exception. Requires captureUncaught to also be set.

So with this config:

var rollbar = new Rollbar({
  captureUncaught: true,
  exitOnUncaughtException: true,
  // ...
});

...an uncaught exception should exit the process.

This works correctly, but only if rollbar.configure() is never called again, because:

  1. exitOnUncaughtException was deleted from our options
  2. Calling configure() calls setupUnhandledCapture()...
  3. ...which calls handleUncaughtExceptions()...
  4. ...which now tries to access options.exitOnUncaughtException
  5. But this option was deleted in Step 1, so when we replace our uncaughtException handler, we now have exitOnUncaught = false

This change:

Type of change

Development

Code review

alecgibson commented 1 year ago

@waltjones any chance of please getting this reviewed? We've still got an ugly patch in our code to work around this issue.