Package org.labkey.remoteapi
Class CommandException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.labkey.remoteapi.CommandException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ApiVersionException
Represents an exception that occurs while executing a command.
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.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCommandException
(String message) Constructs a new CommandException given a message only.CommandException
(String message, int statusCode, org.json.JSONObject jsonProperties, String responseText, String contentType, String authHeaderValue) Constructs a new CommandException given a message, HTTP status code, exception property map, responseText, and contentType. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of the WWW-Authenticate headerReturns the exception property map, or null if no map was set.Returns the text of the responseint
Returns the HTTP status code returned by the server.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CommandException
Constructs a new CommandException given a message only. The status code and properties map will be set to 0 and null respectively- Parameters:
message
- The message text (should not be null).
-
CommandException
public CommandException(String message, int statusCode, org.json.JSONObject jsonProperties, String responseText, String contentType, String authHeaderValue) Constructs a new CommandException given a message, HTTP status code, exception property map, responseText, and contentType.- Parameters:
message
- The message text (should not be null).statusCode
- The HTTP status code.jsonProperties
- The exception property JSONObject (may be null)responseText
- The full response text (may be null)contentType
- The response content type (may be null)authHeaderValue
- The value of the WWW-Authenticate header (may be null)
-
-
Method Details
-
getContentType
-
getStatusCode
public int getStatusCode()Returns the HTTP status code returned by the server.- Returns:
- The HTTP status code.
-
getResponseText
Returns the text of the response- Returns:
- The text of the response
-
getAuthHeaderValue
Returns the value of the WWW-Authenticate header- Returns:
- The value or null
-
getProperties
Returns the exception property map, or null if no map was set.- Returns:
- The exception property map or null.
-