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

Support overriding the ? behavior locally (by redefining the try! macro) #71643

Closed
stevenroose opened this issue Apr 28, 2020 · 2 comments
Closed

Comments

@stevenroose
Copy link

When the ? operator was implemented, it looks like it was meant to be equivalent to the try! macro.

This has the nice property that overriding the try! macro in your own project, allows you to capture all the ? invocations and add additional logic like logging file and line number or wrapping that information into a new error object.

Sadly it seems that the ? operator is no longer equivalent to the try! macro. So overriding try! does not change the behavior of ? in your project. It would be awesome if this would be made possible.

@jonas-schievink
Copy link
Contributor

This is covered partially by #42327, and anything beyond that would require an RFC, so closing in favor of that.

@stevenroose
Copy link
Author

How would it work for the trait to know the file and line number where the error was generated?

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