Class RadioReferenceException

java.lang.Object
java.lang.Throwable
java.lang.Exception
io.github.dsheirer.rrapi.RadioReferenceException
All Implemented Interfaces:
Serializable

public class RadioReferenceException extends Exception
Radio reference API exception. getErrorType() categorizes the error so that callers can decide how to react, and isRetryable() indicates if the same request could succeed later.
See Also:
  • Constructor Details

    • RadioReferenceException

      public RadioReferenceException(String message, Throwable throwable)
      Constructs an instance with the error type derived from the cause: TIMEOUT, INTERRUPTED, NETWORK for other I/O errors, otherwise UNKNOWN
      Parameters:
      message - to report
      throwable - cause
    • RadioReferenceException

      public RadioReferenceException(String message)
      Constructs an instance with error type UNKNOWN
      Parameters:
      message - to report
    • RadioReferenceException

      public RadioReferenceException(String message, int httpStatusCode, Fault fault)
      Constructs an instance with the error type derived from the fault and the HTTP status code
      Parameters:
      message - to report
      httpStatusCode - for the request
      fault - being reported
    • RadioReferenceException

      public RadioReferenceException(RadioReferenceException.ErrorType errorType, String message)
      Constructs an instance
      Parameters:
      errorType - category of the error
      message - to report
    • RadioReferenceException

      public RadioReferenceException(RadioReferenceException.ErrorType errorType, String message, Throwable throwable)
      Constructs an instance
      Parameters:
      errorType - category of the error
      message - to report
      throwable - cause
    • RadioReferenceException

      public RadioReferenceException(RadioReferenceException.ErrorType errorType, String message, int httpStatusCode, Fault fault)
      Constructs an instance
      Parameters:
      errorType - category of the error
      message - to report
      httpStatusCode - of the response
      fault - being reported, or null
  • Method Details

    • getErrorType

      public RadioReferenceException.ErrorType getErrorType()
      Category of the error
    • isRetryable

      public boolean isRetryable()
      Indicates if the same request could succeed when tried again later, e.g. after a timeout or a service error. False for errors that need a change first, e.g. invalid credentials or an invalid id.
    • getRetryAfter

      public Optional<Duration> getRetryAfter()
      Delay that the service requested before retrying, from the HTTP Retry-After header
      Returns:
      delay, or empty when the service didn't specify one
    • withRetryAfter

      public RadioReferenceException withRetryAfter(Duration retryAfter)
      Sets the delay that the service requested before retrying
      Parameters:
      retryAfter - delay or null
      Returns:
      this exception
    • getHttpStatusCode

      public Integer getHttpStatusCode()
      HTTP status code
      Returns:
      status code
    • hasHttpStatusCode

      public boolean hasHttpStatusCode()
      Indicates if this exception has an HTTP status code
      Returns:
      true if non-null
    • getFault

      public Fault getFault()
      SOAP fault
      Returns:
      fault
    • hasFault

      public boolean hasFault()
      Indicates if this exception contains a SOAP fault
      Returns:
      true if non-null