-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
WIP: get better frame info from prepareStackTrace #4232
Conversation
); | ||
.map((callSite): string => { | ||
// @ts-ignore | ||
error["__callSites"].push(callSite); // Save callsites to self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just assign the whole array above/below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can definitely do that, but actually I was thinking about not saving callSite
but an object populated with data we need (since currently I am actually calling a bunch of function from Rust)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @kevinkassimo on this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also consider implementing the entire prepareStackTrace function in C++.
Not 100% sure, but it might be nice to keep the part where the call sites get stored and where they get processed close together.
That is something that I can do if you don't want to btw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@piscisaureus Yeah I think that is reasonable. I don't think I will have enough time to work on it this week (finals are coming), so yeah for sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting a +1 offset for column/row numbers.
Lines 217 to 218 in 93aed08
let line_number = line_number + 1; | |
let column = column + 1; |
Ooops forgot to add 1, but yeah it is a small problem that could be fixed easily. |
This is a hacked-up demo of how to leverage
prepareStackTrace
to get better error messages. Currently there are errors if you try throwing non-error or call eval that errors, but those are problems that could be addressed easily after validating this demo.Example:
Before (deno 0.35.0, thus there are a few more frames than master):
After: