Class CanonException

    • Constructor Detail

      • CanonException

        public CanonException​(int httpStatusCode)
        Constructor with HTTP status code.
        Parameters:
        httpStatusCode - The HTTP status code relating to the cause of this exception.
      • CanonException

        public CanonException​(int httpStatusCode,
                              String message)
        Constructor with HTTP status code and message.
        Parameters:
        httpStatusCode - The HTTP status code relating to the cause of this exception.
        message - A message describing the detail of the exception.
      • CanonException

        public CanonException​(int httpStatusCode,
                              String message,
                              Throwable cause)
        Constructor with HTTP status code, message and cause.
        Parameters:
        httpStatusCode - The HTTP status code relating to the cause of this exception.
        message - A message describing the detail of the exception.
        cause - The underlying cause of the exception.
      • CanonException

        public CanonException​(int httpStatusCode,
                              Throwable cause)
        Constructor with HTTP status code and cause.
        Parameters:
        httpStatusCode - The HTTP status code relating to the cause of this exception.
        cause - The underlying cause of the exception.
      • CanonException

        protected CanonException​(int httpStatusCode,
                                 String message,
                                 Throwable cause,
                                 boolean enableSuppression,
                                 boolean writableStackTrace)
      • CanonException

        public CanonException​(int httpStatusCode,
                              @Nullable
                              String message,
                              org.apache.http.client.methods.CloseableHttpResponse response)
        Constructor with HTTP status code, message and HTTP response. The body of the response is saved and can be retrieved with @see getResponseBody
        Parameters:
        httpStatusCode - The HTTP status code relating to the cause of this exception.
        message - A message describing the detail of the exception.
        response - An HTTP response which is saved as the cause of the exception.
    • Method Detail

      • getHttpStatusCode

        public int getHttpStatusCode()
        Returns:
        The HTTP status code relating to the exception.
      • getResponseBody

        @Nullable
        public String getResponseBody()
        Returns:
        The response body returned by any HTTP request.
      • getResponseHeaders

        @Nullable
        public org.apache.http.Header[] getResponseHeaders()
        Returns:
        The response headers returned by any HTTP request.