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
ConstructorsConstructorDescriptionRestCallException
(int statusCode, Thrown thrown, Throwable cause, String message, Object... args) Constructor.RestCallException
(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.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.
-
RestCallException
public RestCallException(int statusCode, Thrown thrown, Throwable cause, String message, Object... args) Constructor.- Parameters:
statusCode
- The HTTP response status code. Use0 if no connection could be made.thrown
- The value of the"Thrown" header on the 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 .
-
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.
-