Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Node.js Worker support by not shimming uncaughtException #269

Merged
merged 2 commits into from Apr 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions source-map-support.js
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