diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-09-25 15:51:18 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-09-28 02:26:42 +0300 |
commit | aea9a0f77da6a14d4fee2b21b0f4a6a813a01e70 (patch) | |
tree | 6f7c7d54c21337d2debdf00419e03aee3144318e /lib/internal/main | |
parent | c2ce8d05474c38c503b6ac57e94366421c960762 (diff) |
worker: fix process._fatalException return type
This makes sure `process._fatalException()` returns a boolean when
run inside of a worker.
PR-URL: https://github.com/nodejs/node/pull/29706
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Diffstat (limited to 'lib/internal/main')
-rw-r--r-- | lib/internal/main/worker_thread.js | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js index 90e84f204b3..50a19be77dd 100644 --- a/lib/internal/main/worker_thread.js +++ b/lib/internal/main/worker_thread.js @@ -166,26 +166,28 @@ function workerOnGlobalUncaughtException(error, fromPromise) { } debug(`[${threadId}] uncaught exception handled = ${handled}`); - if (!handled) { - let serialized; - try { - const { serializeError } = require('internal/error-serdes'); - serialized = serializeError(error); - } catch {} - debug(`[${threadId}] uncaught exception serialized = ${!!serialized}`); - if (serialized) - port.postMessage({ - type: ERROR_MESSAGE, - error: serialized - }); - else - port.postMessage({ type: COULD_NOT_SERIALIZE_ERROR }); - - const { clearAsyncIdStack } = require('internal/async_hooks'); - clearAsyncIdStack(); - - process.exit(); + if (handled) { + return true; } + + let serialized; + try { + const { serializeError } = require('internal/error-serdes'); + serialized = serializeError(error); + } catch {} + debug(`[${threadId}] uncaught exception serialized = ${!!serialized}`); + if (serialized) + port.postMessage({ + type: ERROR_MESSAGE, + error: serialized + }); + else + port.postMessage({ type: COULD_NOT_SERIALIZE_ERROR }); + + const { clearAsyncIdStack } = require('internal/async_hooks'); + clearAsyncIdStack(); + + process.exit(); } // Patch the global uncaught exception handler so it gets picked up by |