Skip to content

Commit

Permalink
Merge pull request #269 from addaleax/fix-workers
Browse files Browse the repository at this point in the history
Fix Node.js Worker support by not shimming uncaughtException
  • Loading branch information
LinusU committed Apr 19, 2020
2 parents 61ebf23 + 59b442f commit 2a08b93
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions source-map-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,18 @@ exports.install = function(options) {
var installHandler = 'handleUncaughtExceptions' in options ?
options.handleUncaughtExceptions : true;

// Do not override 'uncaughtException' with our own handler in Node.js
// Worker threads. Workers pass the error to the main thread as an event,
// rather than printing something to stderr and exiting.
try {
// Don't let browserify try to resolve this require(), it's pointless
// and breaks the build process.
var worker_threads = require('worker_' + 'threads');
if (worker_threads.isMainThread === false) {
installHandler = false;
}
} catch(e) {}

// Provide the option to not install the uncaught exception handler. This is
// to support other uncaught exception handlers (in test frameworks, for
// example). If this handler is not installed and there are no other uncaught
Expand Down

0 comments on commit 2a08b93

Please sign in to comment.