Package org.apache.juneau.rest.client
Class RestCallException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.apache.http.HttpException
org.apache.juneau.rest.client.RestCallException
- All Implemented Interfaces:
Serializable
Exception representing a 400+ HTTP response code against a remote resource or other exception.
See Also:
-
Constructor Summary
ConstructorDescriptionRestCallException
(RestResponse response, Throwable cause, String message, Object... args) Constructor. -
Method Summary
Modifier and TypeMethodDescription<T extends Throwable>
TSimilar toThrowable.getCause()
but searches until it finds the throwable of the specified type.Returns the HTTP response object that caused this exception.int
Returns the HTTP response status code.Returns the value of the"Thrown" header on the response.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
RestCallException
Constructor.- Parameters:
response
- The HTTP response. Can benull .cause
- The cause of this exception.message
- TheMessageFormat
-style message.args
- OptionalMessageFormat
-style arguments.
-
-
Method Details
-
getThrown
Returns the value of the"Thrown" header on the response.- Returns:
- The value of the
"Thrown" header on the response, nevernull .
-
getResponse
Returns the HTTP response object that caused this exception.- Returns:
- The HTTP response object that caused this exception, or
null if no response was created yet when the exception was thrown.
-
getResponseCode
Returns the HTTP response status code.- Returns:
- The response status code. If a connection could not be made at all, returns
0 .
-
getCause
Similar toThrowable.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.
-