Skip to content

Commit

Permalink
worker: add missing return value in case of fatal exceptions
Browse files Browse the repository at this point in the history
This adds a missing return value for the worker specific fatal
exception handler.

PR-URL: #29036
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
  • Loading branch information
BridgeAR authored and BethGriggs committed Oct 15, 2019
1 parent b43d7e8 commit 2eae030
Showing 1 changed file with 18 additions and 16 deletions.
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

0 comments on commit 2eae030

Please sign in to comment.