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

[auth] Slightly better error message #351

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stepancheg
Copy link

I wrote very simple code:

            google_cloud_storage::client::ClientConfig::default()
                .with_auth()
                .await
                .unwrap();

and error message is not helpful:

called `Result::unwrap()` on an `Err` value: HttpError(reqwest::Error { kind: Decode, source: Error("missing field `access_token`", line: 6, column: 1) })

at least add what server we are talking to the error message to help a bit with reverse engineering what it is trying to do:

called `Result::unwrap()` on an `Err` value: HttpError("https://oauth2.googleapis.com/token", reqwest::Error { kind: Decode, source: Error("missing field `access_token`", line: 6, column: 1) })

@yoshidan yoshidan added the safe to test safe to test label Feb 9, 2025
@yoshidan
Copy link
Owner

Please fix the CI error

error[E0277]: `?` couldn't convert the error to `error::Error`
  --> foundation/auth/src/token_source/external_account_source/mod.rs:92:56
   |
92 |         let it = response.json::<InternalToken>().await?;
   |                                                        ^ the trait `From<reqwest::Error>` is not implemented for `error::Error`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
   = help: the following other types implement trait `From<T>`:
             `error::Error` implements `From<VarError>`
             `error::Error` implements `From<external_account_source::error::Error>`
             `error::Error` implements `From<jsonwebtoken::errors::Error>`
             `error::Error` implements `From<serde_json::Error>`
             `error::Error` implements `From<std::io::Error>`
             `error::Error` implements `From<time::error::Parse>`
   = note: required for `Result<Token, error::Error>` to implement `FromResidual<Result<Infallible, reqwest::Error>>`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test safe to test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants