Skip to content

Commit 2ddefff

Browse files
author
Luca Forstner
committed
Merge remote-tracking branch 'origin/lforst-mimic-native-behaviour-onuncaught-exception' into lforst-fix-nextjs-quitting-on-aborted-requests
2 parents 193ef4f + 05bfb5e commit 2ddefff

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

packages/node-integration-tests/suites/public-api/OnUncaughtException/mimic-native-behaviour-additional-listener-test-script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Sentry.init({
66
return integrations.map(integration => {
77
if (integration.name === 'OnUncaughtException') {
88
return new Sentry.Integrations.OnUncaughtException({
9-
exitEvenWhenOtherOnUncaughtExceptionHandlersAreRegistered: false,
9+
exitEvenIfOtherHandlersAreRegistered: false,
1010
});
1111
} else {
1212
return integration;

packages/node-integration-tests/suites/public-api/OnUncaughtException/mimic-native-behaviour-no-additional-listener-test-script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Sentry.init({
66
return integrations.map(integration => {
77
if (integration.name === 'OnUncaughtException') {
88
return new Sentry.Integrations.OnUncaughtException({
9-
exitEvenWhenOtherOnUncaughtExceptionHandlersAreRegistered: false,
9+
exitEvenIfOtherHandlersAreRegistered: false,
1010
});
1111
} else {
1212
return integration;

packages/node-integration-tests/suites/public-api/OnUncaughtException/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('OnUncaughtException integration', () => {
2828
});
2929
});
3030

31-
describe('with `exitEvenWhenOtherOnUncaughtExceptionHandlersAreRegistered` set to false', () => {
31+
describe('with `exitEvenIfOtherHandlersAreRegistered` set to false', () => {
3232
test('should close process on uncaught error with no additional listeners registered', done => {
3333
expect.assertions(3);
3434

packages/node/src/integrations/onuncaughtexception.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ interface OnUncaughtExceptionOptions {
1313
// Also, we can evaluate using https://nodejs.org/api/process.html#event-uncaughtexceptionmonitor per default, and
1414
// falling back to current behaviour when that's not available.
1515
/**
16-
* Whether the SDK should mimic native behaviour when a global error occurs. Default: `true`
17-
* - `false`: The SDK will exit the process on all uncaught errors.
18-
* - `true`: The SDK will only exit the process when there are no other 'uncaughtException' handlers attached.
16+
* Controls if the SDK should register a handler to exit the process on uncaught errors:
17+
* - `true`: The SDK will exit the process on all uncaught errors.
18+
* - `false`: The SDK will only exit the process when there are no other `uncaughtException` handlers attached.
19+
*
20+
* Default: `true`
1921
*/
20-
exitEvenWhenOtherOnUncaughtExceptionHandlersAreRegistered: boolean;
22+
exitEvenIfOtherHandlersAreRegistered: boolean;
2123

2224
/**
2325
* This is called when an uncaught error would cause the process to exit.
@@ -55,7 +57,7 @@ export class OnUncaughtException implements Integration {
5557
*/
5658
public constructor(options: Partial<OnUncaughtExceptionOptions> = {}) {
5759
this._options = {
58-
exitEvenWhenOtherOnUncaughtExceptionHandlersAreRegistered: true,
60+
exitEvenIfOtherHandlersAreRegistered: true,
5961
...options,
6062
};
6163
}
@@ -108,8 +110,7 @@ export class OnUncaughtException implements Integration {
108110
}, 0);
109111

110112
const processWouldExit = userProvidedListenersCount === 0;
111-
const shouldApplyFatalHandlingLogic =
112-
this._options.exitEvenWhenOtherOnUncaughtExceptionHandlersAreRegistered || processWouldExit;
113+
const shouldApplyFatalHandlingLogic = this._options.exitEvenIfOtherHandlersAreRegistered || processWouldExit;
113114

114115
if (!caughtFirstError) {
115116
const hub = getCurrentHub();

0 commit comments

Comments
 (0)