-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Don't destructure errors using v8::Exception::create_message(), just read error.stack #4153
Comments
CC @piscisaureus I believe that's one of the issues we discussed yesterday |
I was about to raise a similar issue. Just to add context:
Neither the function |
@nayeemrmn It's quite beneficial to have structured exception in Rust, so I would like to find a way to preserve that. Have you tried |
@ry We've gone through that. A test case is given in #2703 and you tried that flag in #2709. There is no way. As explained in #2703 (comment): there are two stack traces, the one we currently get is unconditionally bad and the other is only stored as a string in |
@nayeemrmn Hah sorry. There's too much stuff going on - I forget the details : ) I will discuss it with @piscisaureus and see if we can find a solution. |
@nayeemrmn Is the information you need provided to the Error.prepareStackTrace callback? |
@piscisaureus Ah, it is! That's the structured version of the correct stack trace that is discarded from I guess in our |
@nayeemrmn or in a raw form, I can save this error in some place that is accessible later from JS (e.g. |
Sounds good to me.
Sounds good to me too.
|
@piscisaureus But isn't the intention of this to deal with unhandled promise exceptions? Any caught TLA errors would be handled by users anyways and go through But yeah it is definitely better if we are able do it just in |
Sure enough, but only unhandled exceptions, or any exception (including the ones caught and logged or rethrown)? Maybe I don't understand the problem well enough; if you have a (partial) solution, let's open a PR and discuss that. |
@kevinkassimo The point is that our system in Rust for formatting uncaught errors reads some weird forgotten debug stack trace which is populated differently than the one in |
I hacked up a demo at #4232 (maybe we could move actual prop retrieval to JS side instead of pushing the actual callsite objects) |
To fix #2703 and #2710.
We get structured error data using
v8::Exception::create_message()
and then format them into the colourful strings that get printed on exit. However the stack trace returned by that function is missing async frames among other issues: #2703 (comment). The stack trace we want is not stored structured-ly by V8, but is available as a string inerror.stack
We should instead just printEDIT: The structured version of this correct stack trace can be preserved by saving it from theerror.stack
, regex through it and inject colouring that way if wanted.Error.prepareStackTrace()
callback.It's pretty bad that uncaught errors from async ops print useless stack traces.
Look at the error printed by
Deno.open("nonexistent")
. Imagine that in the logs for a large code base.The text was updated successfully, but these errors were encountered: