public class CommandException
extends java.lang.Exception
An instance of this class is typically thrown when the server returns
a non-success HTTP status code (>= 400). The developer may catch
this exception type and use the getStatusCode()
method
to retrieve the particular HTTP status code.
If the server generated an exception and sent details back to the
client, the exception message will be set as the message text, which
is returned from the toString()
method. Other properties
about the exception, such as the exception class and stack trace, may
be obtained via the getProperties()
method.
Constructor and Description |
---|
CommandException(java.lang.String message)
Constructs a new CommandException given a message only.
|
CommandException(java.lang.String message,
int statusCode,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.lang.String responseText)
Deprecated.
|
CommandException(java.lang.String message,
int statusCode,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.lang.String responseText,
java.lang.String contentType)
Constructs a new CommandException given a message, HTTP status code,
exception property map, responseText, and contentType.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContentType() |
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Returns the exception property map, or null if no map was set.
|
java.lang.String |
getResponseText()
Returns the text of the response
|
int |
getStatusCode()
Returns the HTTP status code returned by the server.
|
public CommandException(java.lang.String message)
message
- The message text (should not be null).public CommandException(java.lang.String message, int statusCode, java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.String responseText)
CommandException(String, int, Map, String, String)
message
- The message text (should not be null).statusCode
- The HTTP status code.properties
- The exception property map (may be null)responseText
- The full response text (may be null)public CommandException(java.lang.String message, int statusCode, java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.String responseText, java.lang.String contentType)
message
- The message text (should not be null).statusCode
- The HTTP status code.properties
- The exception property map (may be null)responseText
- The full response text (may be null)contentType
- The response content type (may be null)public java.lang.String getContentType()
public int getStatusCode()
public java.lang.String getResponseText()
public java.util.Map<java.lang.String,java.lang.Object> getProperties()