-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Remove unwraps via '?' with anyhow crate for example-oauth #2069
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
In general I think we should also use .context("...")?
to make it clear where the error is coming from. Otherwise it can be hard to debug later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Head branch was pushed to by a user without write access
Refs: #2039
Motivation
Substitutes
unwrap
calls with proper error handling via theanyhow
crate forexample-oauth
.Solution
Substitute
unwrap
s with?
viaanyhow
. Usingif let
ormatch
is very verbose and makes the example lose focus. Using?
keeps the example readable, focused and shows better practices.Validated solution by compiling and testing via
CLIENT_ID=REPLACE_ME CLIENT_SECRET=REPLACE_ME cargo run -p example-oauth