@@ -6,10 +6,6 @@ import { logAndExitProcess } from '../utils/errorhandling';
66
77type OnFatalErrorHandler = ( firstError : Error , secondError ?: Error ) => void ;
88
9- type TaggedListener = NodeJS . UncaughtExceptionListener & {
10- tag ?: string ;
11- } ;
12-
139interface OnUncaughtExceptionOptions {
1410 /**
1511 * Controls if the SDK should register a handler to exit the process on uncaught errors:
@@ -83,17 +79,15 @@ export function makeErrorHandler(client: NodeClient, options: OnUncaughtExceptio
8379 // exit behaviour of the SDK accordingly:
8480 // - If other listeners are attached, do not exit.
8581 // - If the only listener attached is ours, exit.
86- const userProvidedListenersCount = ( global . process . listeners ( 'uncaughtException' ) as TaggedListener [ ] ) . filter (
87- listener => {
88- // There are 3 listeners we ignore:
89- return (
90- // as soon as we're using domains this listener is attached by node itself
91- listener . name !== 'domainUncaughtExceptionClear' &&
92- // the handler we register in this integration
93- ( listener as ErrorHandler ) . _errorHandler !== true
94- ) ;
95- } ,
96- ) . length ;
82+ const userProvidedListenersCount = global . process . listeners ( 'uncaughtException' ) . filter ( listener => {
83+ // There are 3 listeners we ignore:
84+ return (
85+ // as soon as we're using domains this listener is attached by node itself
86+ listener . name !== 'domainUncaughtExceptionClear' &&
87+ // the handler we register in this integration
88+ ( listener as ErrorHandler ) . _errorHandler !== true
89+ ) ;
90+ } ) . length ;
9791
9892 const processWouldExit = userProvidedListenersCount === 0 ;
9993 const shouldApplyFatalHandlingLogic = options . exitEvenIfOtherHandlersAreRegistered || processWouldExit ;
0 commit comments