Package jmri.server.json
Class JsonException
java.lang.Object
java.lang.Throwable
java.lang.Exception
jmri.server.json.JsonException
- All Implemented Interfaces:
Serializable
Throw an exception, but include an HTTP error code.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String"code"static final String"error"static final String"ErrorBadPropertyValue", a key for localized error messages indicating the value for the given property is not valid.static final String"ErrorMissingPropertyPut", a key for localized error messages indicating a property required to complete a PUT request is missing.static final String"ErrorNotFound", a key for localized error messages indicating a resource was not found.static final String"ErrorObject", a key for localized error messages indicating an inability to get a requested object.static final String"ErrorUnknownType", a key for localized error messages indicating the requested type cannot be handled.static final String"LoggedError", a key for localized error messages indicating that JMRI logs contain required information to resolve the error.static final String"message" -
Constructor Summary
ConstructorsConstructorDescriptionJsonException(int code, String message, int id) Create an exception that can be passed to a JSON client.JsonException(int code, String message, com.fasterxml.jackson.databind.node.ObjectNode additionalData, int id) Create an exception that can be passed to a JSON client.JsonException(int code, String message, Throwable throwable, int id) Create an exception that can be passed to a JSON client.JsonException(int code, String message, Throwable throwable, com.fasterxml.jackson.databind.node.ObjectNode additionalData, int id) Create an exception that can be passed to a JSON client.JsonException(int code, Throwable throwable, int id) Create an exception that can be passed to a JSON client.JsonException(int code, Throwable throwable, com.fasterxml.jackson.databind.node.ObjectNode additionalData, int id) Create an exception that can be passed to a JSON client. -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.node.ObjectNodeGet any additional data passed to the client.intgetCode()Get the error code (usually an HTTP error code)intgetId()Get the id passed to the client.com.fasterxml.jackson.databind.JsonNodeGet the JSON formatted error message.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
ERROR
"error"- See Also:
-
CODE
"code"- See Also:
-
MESSAGE
"message"- See Also:
-
ERROR_BAD_PROPERTY_VALUE
"ErrorBadPropertyValue", a key for localized error messages indicating the value for the given property is not valid.- See Also:
-
ERROR_MISSING_PROPERTY_PUT
"ErrorMissingPropertyPut", a key for localized error messages indicating a property required to complete a PUT request is missing.- See Also:
-
ERROR_NOT_FOUND
"ErrorNotFound", a key for localized error messages indicating a resource was not found.- See Also:
-
ERROR_OBJECT
"ErrorObject", a key for localized error messages indicating an inability to get a requested object.- See Also:
-
ERROR_UNKNOWN_TYPE
"ErrorUnknownType", a key for localized error messages indicating the requested type cannot be handled.- See Also:
-
LOGGED_ERROR
"LoggedError", a key for localized error messages indicating that JMRI logs contain required information to resolve the error.- See Also:
-
-
Constructor Details
-
JsonException
Create an exception that can be passed to a JSON client.- Parameters:
code- the error codemessage- message, displayable to the user, in the client's preferred localethrowable- the cause of the exceptionid- the message id passed by the client, or the additive inverse of that id
-
JsonException
public JsonException(int code, String message, Throwable throwable, com.fasterxml.jackson.databind.node.ObjectNode additionalData, int id) Create an exception that can be passed to a JSON client.- Parameters:
code- the error codemessage- message, displayable to the user, in the client's preferred localethrowable- the cause of the exceptionadditionalData- additional data to be passed to the clientid- the message id passed by the client, or the additive inverse of that id
-
JsonException
Create an exception that can be passed to a JSON client.- Parameters:
code- the error codethrowable- the cause of the exceptionid- the message id passed by the client, or the additive inverse of that id
-
JsonException
public JsonException(int code, Throwable throwable, com.fasterxml.jackson.databind.node.ObjectNode additionalData, int id) Create an exception that can be passed to a JSON client.- Parameters:
code- the error codethrowable- the cause of the exceptionadditionalData- additional data to be passed to the clientid- the message id passed by the client, or the additive inverse of that id
-
JsonException
Create an exception that can be passed to a JSON client.- Parameters:
code- the error codemessage- message, displayable to the user, in the client's preferred localeid- the message id passed by the client, or the additive inverse of that id
-
JsonException
public JsonException(int code, String message, com.fasterxml.jackson.databind.node.ObjectNode additionalData, int id) Create an exception that can be passed to a JSON client.- Parameters:
code- the error codemessage- message, displayable to the user, in the client's preferred localeadditionalData- additional data to be passed to the clientid- the message id passed by the client, or the additive inverse of that id
-
-
Method Details
-
getCode
Get the error code (usually an HTTP error code)- Returns:
- the code
-
getAdditionalData
Get any additional data passed to the client. This is specific to, and will vary based on, the original exception.- Returns:
- the additional data or null if none
-
getId
Get the id passed to the client.- Returns:
- the absolute value of the id
- See Also:
-
getJsonMessage
Get the JSON formatted error message.- Returns:
- the error message in a JSON format
-