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

Examples and doctests should handle errors properly (no panics) #657

Closed
liranringel opened this issue Sep 22, 2018 · 5 comments
Closed

Examples and doctests should handle errors properly (no panics) #657

liranringel opened this issue Sep 22, 2018 · 5 comments
Milestone

Comments

@liranringel
Copy link
Contributor

Looking in the examples and even the doctests, errors are not handled properly (a lot of uses of unwrap and panic).
Tokio should follow the best practices because it's a core component of the Rust ecosystem. It may mislead newbies that copy-paste those examples.
Today we have the ? operator and can return errors from main, so it's not harder to do so. It is also recommended by the api-guidelines: https://rust-lang-nursery.github.io/api-guidelines/documentation.html#examples-use--not-try-not-unwrap-c-question-mark

@carllerche carllerche added the E-help-wanted Call for participation: Help is requested to fix this issue. label Sep 22, 2018
@SanchayanMaity
Copy link

SanchayanMaity commented Oct 16, 2018

I would like to contribute to this. To clarify, would use of "?" be recommended or match arms are more preferable or it is better to select depending on the particular context? @carllerche @liranringel

@liranringel
Copy link
Contributor Author

@SanchayanMaity
Usually "?".
I already changed most of the examples, I'll probably push it this weekend.
You do the doctests, ok?

@SanchayanMaity
Copy link

@liranringel Ok.

@carllerche
Copy link
Member

I'm 👍 with this.

@liranringel
Copy link
Contributor Author

This issue has been resolved :)

@Darksonn Darksonn removed the E-help-wanted Call for participation: Help is requested to fix this issue. label Sep 25, 2020
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

4 participants