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

refactor(auth): simplify error creation #662

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Jan 9, 2025

Introduce crate private error helpers, as suggested by @coryan in https://github.com/googleapis/google-cloud-rust/pull/656/files#r1909410273 and probably other places.

There is a different issue to rethink whether some of these errors are retryable or not. I am not dealing with that in this PR. I want this PR to be a pure refactor.

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 57.14286% with 9 lines in your changes missing coverage. Please review.

Project coverage is 95.51%. Comparing base (1b7ee25) to head (cfd6595).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/auth/src/credentials/mds_credential.rs 40.00% 3 Missing ⚠️
src/auth/src/credentials.rs 66.66% 2 Missing ⚠️
src/auth/src/credentials/user_credential.rs 66.66% 2 Missing ⚠️
src/auth/src/errors.rs 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #662      +/-   ##
==========================================
+ Coverage   95.36%   95.51%   +0.14%     
==========================================
  Files          31       31              
  Lines        1187     1181       -6     
==========================================
- Hits         1132     1128       -4     
+ Misses         55       53       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dbolduc dbolduc marked this pull request as ready for review January 9, 2025 23:04
@dbolduc dbolduc force-pushed the auth-cleanup-error-factory branch from 7f577b0 to cfd6595 Compare January 10, 2025 00:30
@dbolduc dbolduc enabled auto-merge (squash) January 10, 2025 00:31
@dbolduc dbolduc merged commit 9427edb into googleapis:main Jan 10, 2025
14 checks passed
@dbolduc dbolduc deleted the auth-cleanup-error-factory branch January 10, 2025 01:04
@@ -81,15 +81,12 @@ impl TokenProvider for UserTokenProvider {
let resp = builder
.send()
.await
.map_err(|e| CredentialError::new(false, e.into()))?;
.map_err(CredentialError::non_retryable)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this error not retryable?

if it is a connection error or something like that, it should be possible to retry?

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

Successfully merging this pull request may close these issues.

3 participants