pub struct CredentialsError { /* private fields */ }Expand description
Represents an error using Credentials.
The Google Cloud client libraries may experience problems using credentials to create the necessary authentication headers. For example, a temporary failure to retrieve or create access tokens. Note that these failures may happen even after the credentials files are successfully loaded and parsed.
Applications rarely need to create instances of this error type. The exception might be when testing application code, where the application is mocking a client library behavior. Such tests are extremely rare, most applications should only work with the Error type.
§Example
use google_cloud_gax::error::CredentialsError;
let mut headers = fetch_headers();
while let Err(e) = &headers {
if e.is_transient() {
headers = fetch_headers();
}
}
fn fetch_headers() -> Result<http::HeaderMap, CredentialsError> {
}Implementations§
Source§impl CredentialsError
impl CredentialsError
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Returns true if the error is transient and may succeed in future attempts.
§Example
let mut headers = fetch_headers();
while let Err(e) = &headers {
if e.is_transient() {
headers = fetch_headers();
}
}
fn fetch_headers() -> Result<http::HeaderMap, CredentialsError> {
}Trait Implementations§
Source§impl Clone for CredentialsError
impl Clone for CredentialsError
Source§fn clone(&self) -> CredentialsError
fn clone(&self) -> CredentialsError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CredentialsError
impl Debug for CredentialsError
Source§impl Display for CredentialsError
impl Display for CredentialsError
Source§impl Error for CredentialsError
impl Error for CredentialsError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl SubjectTokenProviderError for CredentialsError
impl SubjectTokenProviderError for CredentialsError
Source§fn is_transient(&self) -> bool
fn is_transient(&self) -> bool
Return true if the error is transient and the call may succeed in the future. Read more
Auto Trait Implementations§
impl Freeze for CredentialsError
impl !RefUnwindSafe for CredentialsError
impl Send for CredentialsError
impl Sync for CredentialsError
impl Unpin for CredentialsError
impl !UnwindSafe for CredentialsError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.