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

Include original error location in Panic.rethrow #11893

Open
radeusgd opened this issue Dec 17, 2024 · 0 comments
Open

Include original error location in Panic.rethrow #11893

radeusgd opened this issue Dec 17, 2024 · 0 comments
Labels
-compiler x-new-feature Type: new feature request

Comments

@radeusgd
Copy link
Member

Currently, Panic.rethrow catches the error, converts it to a raw value (discarding stack trace info) and rethrows as a panic. The Panic's stack trace points to the place where the error was rethrown. All information on where the error originated from is lost at this point.

To aid with debugging, it would be good to be able to still get the original location of the error.

Still, the rethrow location may too be useful (to see where the error re-surfaced and became a panic). So ideally we should retain both. Perhaps we could add a cause field to the panic, that could hold the original dataflow error, and ensure that when printing the stack trace we first print the frames of the rethrow location, followed by a Caused by section that prints the frames/location of the original dataflow error?

Likely to do this we may have to turn Panic.rethrow into a builtin and extend the PanicException.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-compiler x-new-feature Type: new feature request
Projects
Status: New
Development

No branches or pull requests

1 participant