Class GoogleAuthException

All Implemented Interfaces:
Retryable, Serializable
Direct Known Subclasses:
OAuthException

class GoogleAuthException extends IOException implements Retryable
Base class for the standard Auth error response. It extends a default exception while keeping Json response format
  • Field Details

    • isRetryable

      private final boolean isRetryable
    • retryCount

      private final int retryCount
  • Constructor Details

    • GoogleAuthException

      GoogleAuthException(boolean isRetryable, int retryCount, String message, Throwable cause)
      Constructor with all parameters
      Parameters:
      isRetryable - A retry status for the related HTTP request
      retryCount - A number of retries performed for the related HTTP request
      message - The detail message (which is saved for later retrieval by the Throwable.getMessage() method)
      cause - The cause (which is saved for later retrieval by the Throwable.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 request
      retryCount - A number of retries performed for the related HTTP request
      cause - The cause (which is saved for later retrieval by the Throwable.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 the retryCount parameter
    • GoogleAuthException

      GoogleAuthException(boolean isRetryable, Throwable cause)
      Constructor without explicit retry count.
      Parameters:
      isRetryable - A retry status for the related HTTP request
      cause - The cause (which is saved for later retrieval by the Throwable.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 the Throwable.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 on HttpResponseException and a custom error message.
      Parameters:
      responseException - an instance of HttpResponseException
      message - The detail message (which is saved for later retrieval by the Throwable.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 on HttpResponseException 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 of HttpResponseException
      Returns:
      new instance of GoogleAuthException
    • createWithTokenEndpointIOException

      static GoogleAuthException createWithTokenEndpointIOException(IOException ioException, String message)
      Creates an instance of the exception based on IOException and a custom error message.
      Parameters:
      ioException - an instance of IOException
      message - The detail message (which is saved for later retrieval by the Throwable.getMessage() method)
      Returns:
      new instance of GoogleAuthException
      See Also:
    • createWithTokenEndpointIOException

      static GoogleAuthException createWithTokenEndpointIOException(IOException ioException)
      Creates an instance of the exception based on IOException 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 of IOException
      Returns:
      new instance of GoogleAuthException
      See Also:
    • isRetryable

      public boolean isRetryable()
      Returns true if the error is retryable, false otherwise
      Specified by:
      isRetryable in interface Retryable
      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 interface Retryable
      Returns:
      a number of performed retries