Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumNodeJSWorker threads basicsSingle-choice MCQ

A worker thread throws an error that is never caught inside the worker. How does this surface to the parent thread?

const { Worker, isMainThread } = require('worker_threads'); if (isMainThread) { const w = new Worker(__filename); // how do we observe the failure here? } else { throw new Error('boom'); }