Class RestCallException

All Implemented Interfaces:
Serializable

public class RestCallException extends HttpException
Exception representing a 400+ HTTP response code against a remote resource or other exception.
See Also:
  • Constructor Details

    • RestCallException

      public RestCallException(RestResponse response, Throwable cause, String message, Object... args)
      Constructor.
      Parameters:
      response - The HTTP response. Can be null.
      cause - The cause of this exception.
      message - The MessageFormat-style message.
      args - Optional MessageFormat-style arguments.
    • RestCallException

      public RestCallException(int statusCode, Thrown thrown, Throwable cause, String message, Object... args)
      Constructor.
      Parameters:
      statusCode - The HTTP response status code. Use 0 if no connection could be made.
      thrown - The value of the "Thrown" header on the response. Can be null.
      cause - The cause of this exception.
      message - The MessageFormat-style message.
      args - Optional MessageFormat-style arguments.
  • Method Details

    • getThrown

      public Thrown getThrown()
      Returns the value of the "Thrown" header on the response.
      Returns:
      The value of the "Thrown" header on the response, never null.
    • getResponseCode

      public int getResponseCode()
      Returns the HTTP response status code.
      Returns:
      The response status code. If a connection could not be made at all, returns 0.
    • getCause

      public <T extends Throwable> T getCause(Class<T> c)
      Similar to Throwable.getCause() but searches until it finds the throwable of the specified type.
      Type Parameters:
      T - The throwable type.
      Parameters:
      c - The throwable type.
      Returns:
      The cause of the specified type, or null of not found.