Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
worker: add missing return value in case of fatal exceptions
This adds a missing return value for the worker specific fatal
exception handler.
  • Loading branch information
BridgeAR committed Sep 24, 2019
commit 26d3b0a757c91614f2a42dba3da9f67a99689044
34 changes: 18 additions & 16 deletions lib/internal/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,23 +489,25 @@ function setupChild(evalScript) {
}
debug(`[${threadId}] fatal exception caught = ${caught}`);

if (!caught) {
let serialized;
try {
serialized = serializeError(error);
} catch {}
debug(`[${threadId}] fatal exception serialized = ${!!serialized}`);
if (serialized)
port.postMessage({
type: messageTypes.ERROR_MESSAGE,
error: serialized
});
else
port.postMessage({ type: messageTypes.COULD_NOT_SERIALIZE_ERROR });
clearAsyncIdStack();

process.exit();
if (caught) {
return true;
}

let serialized;
try {
serialized = serializeError(error);
} catch {}
debug(`[${threadId}] fatal exception serialized = ${!!serialized}`);
if (serialized)
port.postMessage({
type: messageTypes.ERROR_MESSAGE,
error: serialized
});
else
port.postMessage({ type: messageTypes.COULD_NOT_SERIALIZE_ERROR });
clearAsyncIdStack();

process.exit();
}
}

Expand Down