pub trait SubjectTokenProviderError:
Error
+ Send
+ Sync
+ 'static {
// Required method
fn is_transient(&self) -> bool;
}Expand description
Represents an error using SubjectTokenProvider.
The Google Cloud client libraries may experience problems when fetching the subject token. For example, a temporary error may occur when SubjectTokenProvider tries to fetch the token from a third party service.
Applications rarely need to create instances of this error type. The exception may be when they are providing their own custom SubjectTokenProvider implementation.
§Example
#[derive(Debug)]
struct CustomTokenError {
message: String,
is_transient: bool,
}
impl fmt::Display for CustomTokenError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.message)
}
}
impl Error for CustomTokenError {}
impl SubjectTokenProviderError for CustomTokenError {
fn is_transient(&self) -> bool {
self.is_transient
}
}Required Methods§
Sourcefn is_transient(&self) -> bool
fn is_transient(&self) -> bool
Return true if the error is transient and the call may succeed in the future.
Applications should only return true if the error automatically recovers, without the need for any human action.
Timeouts and network problems are good candidates for is_transient() == true.
Configuration errors that require changing a file, or installing an executable are not.