Class 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 Constructor
      GoogleAuthException​(boolean isRetryable, int retryCount, java.lang.String message, java.lang.Throwable cause)
      Constructor with all parameters
      GoogleAuthException​(boolean isRetryable, int retryCount, java.lang.Throwable cause)
      Constructor with message defaulted to the cause
      GoogleAuthException​(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 on IOException 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 on IOException and a custom error message.
      (package private) static GoogleAuthException createWithTokenEndpointResponseException​(com.google.api.client.http.HttpResponseException responseException)
      Creates an instance of the exception based on HttpResponseException 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 on HttpResponseException and a custom error message.
      int getRetryCount()
      Returns number of reties performed for the related HTTP request
      boolean isRetryable()
      Returns true if the error is retryable, false otherwise
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • isRetryable

        private final boolean isRetryable
      • retryCount

        private final int retryCount
    • 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 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,
                            java.lang.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,
                            java.lang.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​(java.lang.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 Detail

      • createWithTokenEndpointResponseException

        static GoogleAuthException createWithTokenEndpointResponseException​(com.google.api.client.http.HttpResponseException responseException,
                                                                            java.lang.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(HttpResponseException, String)
      • 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​(java.io.IOException ioException,
                                                                      java.lang.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(IOException)
      • createWithTokenEndpointIOException

        static GoogleAuthException createWithTokenEndpointIOException​(java.io.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:
        createWithTokenEndpointIOException(IOException)
      • 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