Skip to content

Use ? instead of try! #1

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

Open
janhohenheim opened this issue Jul 24, 2017 · 3 comments
Open

Use ? instead of try! #1

janhohenheim opened this issue Jul 24, 2017 · 3 comments

Comments

@janhohenheim
Copy link

RFC

@TrionProg
Copy link
Owner

Hello. Thank you for RFC, but I guess, you've read documentation not careful =). Doc says:
This macro looks like standard try!() macro but it gets information where the error has been occurred. ? = try! = match $expr { Ok (ok) => ok, Err(e) => Err(e) }. Am I right? I will be happy if ? will call $error( error_info!(), Box::new(e) ), but this future is not supported, am I right?

About catch I hear for the first time. This is seriously funny. Hmm, I think, I should add it into example, but I've never needed catch.

@janhohenheim
Copy link
Author

janhohenheim commented Jul 24, 2017

As you can see from the actual PR, the the ? operator is de facto equivalent with try! and has replaced the latter in the rustc source itself.

@TrionProg
Copy link
Owner

Can it get information, where this error has been occurred?

Note:I use ? only with errors, that already contain this information(but then I get ErrorInfo of impl_from_error!(), this is also not good =( ). So I think, ? should get this information!

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