Package com.google.auth.oauth2
Class GoogleAuthException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
com.google.auth.oauth2.GoogleAuthException
- All Implemented Interfaces:
Retryable
,Serializable
- Direct Known Subclasses:
OAuthException
Base class for the standard Auth error response. It extends a default exception while keeping
Json response format
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionA default ConstructorGoogleAuthException
(boolean isRetryable, int retryCount, String message, Throwable cause) Constructor with all parametersGoogleAuthException
(boolean isRetryable, int retryCount, Throwable cause) Constructor with message defaulted to the causeGoogleAuthException
(boolean isRetryable, Throwable cause) Constructor without explicit retry count.GoogleAuthException
(Throwable cause) Constructor without retry info -
Method Summary
Modifier and TypeMethodDescription(package private) static GoogleAuthException
createWithTokenEndpointIOException
(IOException ioException) Creates an instance of the exception based onIOException
returned by Google token endpoint.(package private) static GoogleAuthException
createWithTokenEndpointIOException
(IOException ioException, String message) Creates an instance of the exception based onIOException
and a custom error message.(package private) static GoogleAuthException
createWithTokenEndpointResponseException
(com.google.api.client.http.HttpResponseException responseException) Creates an instance of the exception based onHttpResponseException
returned by Google token endpoint.(package private) static GoogleAuthException
createWithTokenEndpointResponseException
(com.google.api.client.http.HttpResponseException responseException, String message) Creates an instance of the exception based onHttpResponseException
and a custom error message.int
Returns number of reties performed for the related HTTP requestboolean
Returns true if the error is retryable, false otherwiseMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
isRetryable
private final boolean isRetryable -
retryCount
private final int retryCount
-
-
Constructor Details
-
GoogleAuthException
Constructor with all parameters- Parameters:
isRetryable
- A retry status for the related HTTP requestretryCount
- A number of retries performed for the related HTTP requestmessage
- The detail message (which is saved for later retrieval by theThrowable.getMessage()
method)cause
- The cause (which is saved for later retrieval by theThrowable.getCause()
method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
-
GoogleAuthException
GoogleAuthException(boolean isRetryable, int retryCount, Throwable cause) Constructor with message defaulted to the cause- Parameters:
isRetryable
- A retry status for the related HTTP requestretryCount
- A number of retries performed for the related HTTP requestcause
- The cause (which is saved for later retrieval by theThrowable.getCause()
method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.) If the cause has retry information, it is going to be skipped in favor of theretryCount
parameter
-
GoogleAuthException
GoogleAuthException(boolean isRetryable, Throwable cause) Constructor without explicit retry count.- Parameters:
isRetryable
- A retry status for the related HTTP requestcause
- The cause (which is saved for later retrieval by theThrowable.getCause()
method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
-
GoogleAuthException
GoogleAuthException(Throwable cause) Constructor without retry info- Parameters:
cause
- The cause (which is saved for later retrieval by theThrowable.getCause()
method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
-
GoogleAuthException
GoogleAuthException()A default Constructor
-
-
Method Details
-
createWithTokenEndpointResponseException
static GoogleAuthException createWithTokenEndpointResponseException(com.google.api.client.http.HttpResponseException responseException, String message) Creates an instance of the exception based onHttpResponseException
and a custom error message.- Parameters:
responseException
- an instance ofHttpResponseException
message
- The detail message (which is saved for later retrieval by theThrowable.getMessage()
method)- Returns:
- new instance of
GoogleAuthException
- See Also:
-
createWithTokenEndpointResponseException
static GoogleAuthException createWithTokenEndpointResponseException(com.google.api.client.http.HttpResponseException responseException) Creates an instance of the exception based onHttpResponseException
returned by Google token endpoint. It uses response status code information to populate the#isRetryable
property and a number of performed attempts to populate the#retryCount
property- Parameters:
responseException
- an instance ofHttpResponseException
- Returns:
- new instance of
GoogleAuthException
-
createWithTokenEndpointIOException
static GoogleAuthException createWithTokenEndpointIOException(IOException ioException, String message) Creates an instance of the exception based onIOException
and a custom error message.- Parameters:
ioException
- an instance ofIOException
message
- The detail message (which is saved for later retrieval by theThrowable.getMessage()
method)- Returns:
- new instance of
GoogleAuthException
- See Also:
-
createWithTokenEndpointIOException
Creates an instance of the exception based onIOException
returned by Google token endpoint. It uses response status code information to populate the#isRetryable
property and a number of performed attempts to populate the#retryCount
property- Parameters:
ioException
- an instance ofIOException
- Returns:
- new instance of
GoogleAuthException
- See Also:
-
isRetryable
public boolean isRetryable()Returns true if the error is retryable, false otherwise- Specified by:
isRetryable
in interfaceRetryable
- Returns:
- true if related error is retryable, false otherwise
-
getRetryCount
public int getRetryCount()Returns number of reties performed for the related HTTP request- Specified by:
getRetryCount
in interfaceRetryable
- Returns:
- a number of performed retries
-