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 GoogleAuthExceptioncreateWithTokenEndpointIOException(IOException ioException) Creates an instance of the exception based onIOExceptionreturned by Google token endpoint.(package private) static GoogleAuthExceptioncreateWithTokenEndpointIOException(IOException ioException, String message) Creates an instance of the exception based onIOExceptionand a custom error message.(package private) static GoogleAuthExceptioncreateWithTokenEndpointResponseException(com.google.api.client.http.HttpResponseException responseException) Creates an instance of the exception based onHttpResponseExceptionreturned by Google token endpoint.(package private) static GoogleAuthExceptioncreateWithTokenEndpointResponseException(com.google.api.client.http.HttpResponseException responseException, String message) Creates an instance of the exception based onHttpResponseExceptionand a custom error message.intReturns number of reties performed for the related HTTP requestbooleanReturns true if the error is retryable, false otherwiseMethods inherited from class 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 theretryCountparameter
-
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 onHttpResponseExceptionand a custom error message.- Parameters:
responseException- an instance ofHttpResponseExceptionmessage- 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 onHttpResponseExceptionreturned by Google token endpoint. It uses response status code information to populate the#isRetryableproperty and a number of performed attempts to populate the#retryCountproperty- 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 onIOExceptionand a custom error message.- Parameters:
ioException- an instance ofIOExceptionmessage- 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 onIOExceptionreturned by Google token endpoint. It uses response status code information to populate the#isRetryableproperty and a number of performed attempts to populate the#retryCountproperty- 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:
isRetryablein 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:
getRetryCountin interfaceRetryable- Returns:
- a number of performed retries
-