-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Stacktrace can ignore user-owned file when using tearoff #56918
Comments
Summary: The stack trace in Dart's |
That looks correct. The Then it calls the function, which is the tear-off In the first example, the argument function was Errors that happen in asynchronous code do not have the original stack any more, that's just how event loops work. |
I know this is the current behaviour. Sorry if I was not clear on my request. I'd like to ask if there is any way for the call stack to know about the call being a tear off (at least when developing). If this is possible, we could possibly show more information to the programmer in cases like the above so it's easier to find errors even in asynchronous code. |
I guess could be technically possible for an instance member tear-off to record where in the code the tear-off occurred, at least in development mode. It will still be equal ( |
Just to be clear, for the above case as an example, are you talking about Just because both could help here but they would show slightly different things in the stack trace I believe. |
I'm talking about I doubt the caller itself will know where the function came from, anything special had to happen in the method. I don't know how the tear-off works. (But I'll stop guessing now and leave this to people who actually know what the VM is doing.) |
The VM does not record where a function was torn off from and we do not have plans to implement that. |
Repro:
This code throws an error:
Focus on line 1 (not 0) where it tells me the file, function, line and offset of where the error was thrown.
If you use a tear off:
This is the output:
I have no more reference as to where this happened on my code. I think this should be better handled for better DX. I was struggling for more than half an hour on my Flutter project with many different files and pages when I realized where this could be happening. The
uncaught exceptions
also triggers inside the framework code and there is no way for you to go back to your own code.The text was updated successfully, but these errors were encountered: