vscode-js-debug: Stack trace from throw in debug console should hide everything below "eval"

Is your feature request related to a problem? Please describe.

When I do something in the debug console that throws, I get a huge massive error message, which I have to scroll all the way past to figure out what I did wrong (99% of the time, I’ve hit enter instead of tab when trying to auto-complete; that’s a different problem).

Describe the feature you’d like

The stack trace that is shown for errors that are thrown should drop anything past the eval, since that’s where the executed code is actually rooted from. Nothing below eval in the trace string is really controllable; that’s just where you are in the debug session.

Anything eval and “above” is what should be kept, so you can see errors thrown from functions called from the console, like:

image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 18 (18 by maintainers)

Commits related to this issue

Most upvoted comments

It’s our old friend sourcemap renames: in renaming identifiers, the program is re-generated from its AST, and Acorn is not aware of comments, so the sourceURL is not set in any expression that uses a renamed identifier

I have it working; will send something on Monday.

image

The code path I linked deals with the response from a REPL evaluation. However, yes, we need to know what frame in the stack was the expression. One way to do this would be to name the sources ahead of time by appending a \n//# sourceURL=... comment at the end prior to evaluation. We do that for internal scripts to avoid cluttering the Loaded Scripts view.