Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error stack trace sent to the inspector contains ANSI escape codes #28287

Closed
joyeecheung opened this issue Jun 19, 2019 · 0 comments
Closed

Error stack trace sent to the inspector contains ANSI escape codes #28287

joyeecheung opened this issue Jun 19, 2019 · 0 comments
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core. inspector Issues and PRs related to the V8 inspector protocol

Comments

@joyeecheung
Copy link
Member

joyeecheung commented Jun 19, 2019

Screen Shot 2019-06-19 at 4 39 06 PM

Refs: #27052

One solution may be skipping

er.stack = inspect(er, { colors });

If the inspector is listening. Another alternative is to pass a different stack trace to V8Inspector::exceptionThrown().

Although..it might even be possible to customize the styles displayed in the DevTools but then I don't suppose it's easy to add that to the inspector protocol so that every inspector client handles it properly.

@joyeecheung joyeecheung added inspector Issues and PRs related to the V8 inspector protocol errors Issues and PRs related to JavaScript errors originated in Node.js core. labels Jun 19, 2019
targos pushed a commit that referenced this issue Jul 2, 2019
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: #28308
Fixes: #28287
Reviewed-By: Benjamin Gruenbaum <[email protected]>
targos pushed a commit that referenced this issue Jul 2, 2019
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: #28308
Fixes: #28287
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core. inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
1 participant