Class CanonException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.symphonyoss.s2.canon.runtime.exception.CanonException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BadRequestException,NoSuchRecordException,NotAuthenticatedException,NotFoundException,PermissionDeniedException,ServerErrorException
public class CanonException extends RuntimeException
An Exception which may be thrown by Canon implementing methods to indicate an exceptional return. This class defines the mapping of HTTP status codes where applicable.- Author:
- Bruce Skingle
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description CanonException(int httpStatusCode)Constructor with HTTP status code.CanonException(int httpStatusCode, String message)Constructor with HTTP status code and message.CanonException(int httpStatusCode, String message, Throwable cause)Constructor with HTTP status code, message and cause.protectedCanonException(int httpStatusCode, String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace)CanonException(int httpStatusCode, String message, org.apache.http.client.methods.CloseableHttpResponse response)Constructor with HTTP status code, message and HTTP response.CanonException(int httpStatusCode, Throwable cause)Constructor with HTTP status code and cause.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetHttpStatusCode()StringgetResponseBody()org.apache.http.Header[]getResponseHeaders()-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
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.
-
-