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

Feature Request: cleaner stack traces #48

Closed
getify opened this issue Feb 7, 2019 · 5 comments
Closed

Feature Request: cleaner stack traces #48

getify opened this issue Feb 7, 2019 · 5 comments

Comments

@getify
Copy link

getify commented Feb 7, 2019

(Note: I have transpilation turned off. I know that feature would mess with this request significantly, and would require sourcemaps support to get right. So I'm only asking for the fix in non-transpiled mode at the moment.)

See this stack trace:

screen shot 2019-02-07 at 12 00 15 pm

As you can see, most of that stack trace is entirely irrelevant to me, as it's stuff happening inside of RunJS (node, I guess?)... including the promise resolution, etc.

I know that the stack trace is not your doing, but it would be nice if you could edit its output to make it more friendly to read.

For example, this stack trace:

SyntaxError: Unexpected token :
    at <anonymous>:5:41
    at <anonymous>:5:65
    at resolve (/Applications/RunJS.app/Contents/Resources/electron.asar/renderer/web-frame-init.js:15:33)
    at new Promise (<anonymous>)
    at EventEmitter.ipcRenderer.on (/Applications/RunJS.app/Contents/Resources/electron.asar/renderer/web-frame-init.js:14:5)
    at EventEmitter.emit (events.js:182:13)

could maybe be truncated to just:

SyntaxError: Unexpected token :
    at <anonymous>:5:41
    at <anonymous>:5:65

or even better, fixing the line/column numbers:

SyntaxError: Unexpected token :
    at <anonymous>:1:7

I know this is challenging to do, but it would be really nice to have at some point.

@lukehaas
Copy link
Owner

lukehaas commented Feb 9, 2019

Could you tell me which version of RunJS you're using?
I thought this had been resolved in 1.2.4

@getify
Copy link
Author

getify commented Feb 9, 2019

I just made sure I was on 1.2.4, and now I'm seeing something different, which is that if I have an error with only one line of code, no error shows...

screen shot 2019-02-09 at 2 27 38 pm

screen shot 2019-02-09 at 2 28 18 pm

...but if all I do is add an extra blank line to the program, now exceptions show up:

screen shot 2019-02-09 at 2 29 04 pm

screen shot 2019-02-09 at 2 28 36 pm

Also, not sure what the "unknown" part in those errors is supposed to indicate. The first snippet should say "ReferenceError" and the second one should say "SyntaxError".

@lukehaas
Copy link
Owner

The missing error for one line of code is a simple, dumb bug in my code. I will have a fix in my next release.
Regarding the error messages, this has been more interesting. These error messages are from Babel and they come out of a caught exception. The original error message in both these cases starts with "SyntaxError: unknown: " but I was outputting the message property of the error which dropped the "SyntaxError: " part.
The "unknown" part is where Babel would typically name the file that the error came from, so not relevant in this case.

In my solution I will be dropping the "unknown: " part of the error and preserving the "SyntaxError: ".
Unfortunately it doesn't look like there's a way for me to differentiate between a "ReferenceError" and a "SyntaxError" here.

@getify
Copy link
Author

getify commented Feb 10, 2019

The original error message in both these cases starts with "SyntaxError...

Hmmm... ok, that seems like a Babylon bug. I will confirm and file that.

@lukehaas
Copy link
Owner

1.3.0 resolves the above issues apart from the Babylon bug.

@getify getify closed this as completed Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants