File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -561,6 +561,18 @@ exports.install = function(options) {
561
561
var installHandler = 'handleUncaughtExceptions' in options ?
562
562
options . handleUncaughtExceptions : true ;
563
563
564
+ // Do not override 'uncaughtException' with our own handler in Node.js
565
+ // Worker threads. Workers pass the error to the main thread as an event,
566
+ // rather than printing something to stderr and exiting.
567
+ try {
568
+ // Don't let browserify try to resolve this require(), it's pointless
569
+ // and breaks the build process.
570
+ var worker_threads = require ( 'worker_' + 'threads' ) ;
571
+ if ( worker_threads . isMainThread === false ) {
572
+ installHandler = false ;
573
+ }
574
+ } catch ( e ) { }
575
+
564
576
// Provide the option to not install the uncaught exception handler. This is
565
577
// to support other uncaught exception handlers (in test frameworks, for
566
578
// example). If this handler is not installed and there are no other uncaught
You can’t perform that action at this time.
0 commit comments