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
,java.io.Serializable
- Direct Known Subclasses:
OAuthException
class GoogleAuthException extends java.io.IOException implements Retryable
Base class for the standard Auth error response. It extends a default exception while keeping Json response format
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
isRetryable
private int
retryCount
-
Constructor Summary
Constructors Constructor Description GoogleAuthException()
A default ConstructorGoogleAuthException(boolean isRetryable, int retryCount, java.lang.String message, java.lang.Throwable cause)
Constructor with all parametersGoogleAuthException(boolean isRetryable, int retryCount, java.lang.Throwable cause)
Constructor with message defaulted to the causeGoogleAuthException(boolean isRetryable, java.lang.Throwable cause)
Constructor without explicit retry count.GoogleAuthException(java.lang.Throwable cause)
Constructor without retry info
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static GoogleAuthException
createWithTokenEndpointIOException(java.io.IOException ioException)
Creates an instance of the exception based onIOException
returned by Google token endpoint.(package private) static GoogleAuthException
createWithTokenEndpointIOException(java.io.IOException ioException, java.lang.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, java.lang.String message)
Creates an instance of the exception based onHttpResponseException
and a custom error message.int
getRetryCount()
Returns number of reties performed for the related HTTP requestboolean
isRetryable()
Returns true if the error is retryable, false otherwise
-
-
-
Constructor Detail
-
GoogleAuthException
GoogleAuthException(boolean isRetryable, int retryCount, java.lang.String message, java.lang.Throwable cause)
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, java.lang.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, java.lang.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(java.lang.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 Detail
-
createWithTokenEndpointResponseException
static GoogleAuthException createWithTokenEndpointResponseException(com.google.api.client.http.HttpResponseException responseException, java.lang.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(HttpResponseException, String)
-
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(java.io.IOException ioException, java.lang.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(IOException)
-
createWithTokenEndpointIOException
static GoogleAuthException createWithTokenEndpointIOException(java.io.IOException ioException)
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:
createWithTokenEndpointIOException(IOException)
-
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
-
-