diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-06-20 07:13:26 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2019-06-27 20:22:08 +0800 |
commit | 94454927f697840a25c1ae73ebbcf9a5324b9060 (patch) | |
tree | 14d7579730ebbaf77d5f9b6945bbf408457b76e4 /lib/internal/process | |
parent | ed8fc7e11d688cbcdf33d0d149830064758bdcd2 (diff) | |
download | android-node-v8-94454927f697840a25c1ae73ebbcf9a5324b9060.tar.gz android-node-v8-94454927f697840a25c1ae73ebbcf9a5324b9060.tar.bz2 android-node-v8-94454927f697840a25c1ae73ebbcf9a5324b9060.zip |
process: split routines used to enhance fatal exception stack traces
Previously the enhancement were done right after emitting
`'uncaughtException'`, which meant by the time we knew the
exception was fatal in C++, the error.stack had already been
patched.
This patch moves those routines to be called later during the
fatal exception handling, and split them into two stages:
before and after the inspector is notified by the invocation of
`V8Inspector::exceptionThrown`. We now expand the stack to include
additional informations about unhandled 'error' events before
the inspector is notified, but delay the highlighting of the
frames until after the inspector is notified, so that the
ANSI escape sequences won't show up in the inspector console.
PR-URL: https://github.com/nodejs/node/pull/28308
Fixes: https://github.com/nodejs/node/issues/28287
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'lib/internal/process')
-rw-r--r-- | lib/internal/process/execution.js | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/lib/internal/process/execution.js b/lib/internal/process/execution.js index 962bf0c809..06dfbce295 100644 --- a/lib/internal/process/execution.js +++ b/lib/internal/process/execution.js @@ -150,10 +150,6 @@ function createOnGlobalUncaughtException() { } else if (!process.emit('uncaughtException', er, type)) { // If someone handled it, then great. Otherwise, die in C++ land // since that means that we'll exit the process, emit the 'exit' event. - const { inspect } = require('internal/util/inspect'); - const colors = internalBinding('util').guessHandleType(2) === 'TTY' && - require('internal/tty').hasColors() || - inspect.defaultOptions.colors; try { if (!process._exiting) { process._exiting = true; @@ -163,14 +159,6 @@ function createOnGlobalUncaughtException() { } catch { // Nothing to be done about it at this point. } - try { - const { kExpandStackSymbol } = require('internal/util'); - if (typeof er[kExpandStackSymbol] === 'function') - er[kExpandStackSymbol](); - er.stack = inspect(er, { colors }); - } catch { - // Nothing to be done about it at this point. - } return false; } |