Commit 2e1fe81
committed
fix: exit server after reconfiguring
According to [the docs][1], `exitOnUncaughtException` should:
> Exit the process after handling an uncaught exception. Requires
> `captureUncaught` to also be set.
So with this config:
```js
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][2] from our options
2. Calling `configure()` calls [`setupUnhandledCapture()`][3]...
3. ...which calls [`handleUncaughtExceptions()`][4]...
4. ...which now [tries to access][5] `options.exitOnUncaughtException`
5. But this option was deleted in Step 1, so when we [replace][6] our
`uncaughtException` handler, we now have `exitOnUncaught = false`
This change:
- no longer deletes `exitOnUncaughtException` from options (it's
unclear why this is the only option that is deleted)
- directly accesses `options.exitOnUncaughtException` in the
handler, just like `options.captureUncaught` is accessed directly
[1]: https://docs.rollbar.com/docs/rollbarjs-configuration-reference#context-1
[2]: https://github.com/rollbar/rollbar.js/blob/e964ecbdb16a4d2b8b5feaa8b70a2ec327648ed0/src/server/rollbar.js#L587
[3]: https://github.com/rollbar/rollbar.js/blob/e964ecbdb16a4d2b8b5feaa8b70a2ec327648ed0/src/server/rollbar.js#L118
[4]: https://github.com/rollbar/rollbar.js/blob/e964ecbdb16a4d2b8b5feaa8b70a2ec327648ed0/src/server/rollbar.js#L578
[5]: https://github.com/rollbar/rollbar.js/blob/e964ecbdb16a4d2b8b5feaa8b70a2ec327648ed0/src/server/rollbar.js#L586
[6]: https://github.com/rollbar/rollbar.js/blob/e964ecbdb16a4d2b8b5feaa8b70a2ec327648ed0/src/server/rollbar.js#L5891 parent ca540c9 commit 2e1fe81
2 files changed
+33
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | 586 | | |
590 | 587 | | |
591 | 588 | | |
| |||
597 | 594 | | |
598 | 595 | | |
599 | 596 | | |
600 | | - | |
| 597 | + | |
601 | 598 | | |
602 | 599 | | |
603 | 600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
553 | 585 | | |
554 | 586 | | |
555 | 587 | | |
| |||
0 commit comments