Skip to content

Commit

Permalink
Remove try/catch when importing node's worker_threads
Browse files Browse the repository at this point in the history
This seems like excessive error checking.  Node has supported
`worker_threads` going back v15 and the error folks will when this
module is missing should be pretty clear/actionable without us adding
this extra info.

Also remove unneeded local variable.
  • Loading branch information
sbc100 committed Jan 9, 2024
1 parent 90696df commit 1d72ce7
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,7 @@ if (ENVIRONMENT_IS_NODE) {
Module['inspect'] = () => '[Emscripten Module object]';

#if PTHREADS || WASM_WORKERS
let nodeWorkerThreads;
try {
nodeWorkerThreads = require('worker_threads');
} catch (e) {
console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?');
throw e;
}
global.Worker = nodeWorkerThreads.Worker;
global.Worker = require('worker_threads').Worker;
#endif

#if WASM == 2
Expand Down

0 comments on commit 1d72ce7

Please sign in to comment.