#How to make workers unable to crash the main program

1 messages · Page 1 of 1 (latest)

safe ermine
#

you can catch it by listening to the error event on the worker object

#
const worker = new Worker("./worker.ts", {type: "module"});

worker.addEventListener("error", (evt) => {
  console.log(evt);  // or do whatever error handling
  evt.preventDefault();  // this keeps the program from exiting
});