Package jmri.server.json
Class JsonException
java.lang.Object
java.lang.Throwable
java.lang.Exception
jmri.server.json.JsonException
- All Implemented Interfaces:
Serializable
public class JsonException extends Exception
Throw an exception, but include an HTTP error code.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static String
CODE
"code"static String
ERROR
"error"static String
ERROR_BAD_PROPERTY_VALUE
"ErrorBadPropertyValue", a key for localized error messages indicating the value for the given property is not valid.static String
ERROR_MISSING_PROPERTY_PUT
"ErrorMissingPropertyPut", a key for localized error messages indicating a property required to complete a PUT request is missing.static String
ERROR_NOT_FOUND
"ErrorNotFound", a key for localized error messages indicating a resource was not found.static String
ERROR_OBJECT
"ErrorObject", a key for localized error messages indicating an inability to get a requested object.static String
ERROR_UNKNOWN_TYPE
"ErrorUnknownType", a key for localized error messages indicating the requested type cannot be handled.static String
LOGGED_ERROR
"LoggedError", a key for localized error messages indicating that JMRI logs contain required information to resolve the error.static String
MESSAGE
"message" -
Constructor Summary
Constructors Constructor Description JsonException(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 Type Method Description com.fasterxml.jackson.databind.node.ObjectNode
getAdditionalData()
Get any additional data passed to the client.int
getCode()
Get the error code (usually an HTTP error code)int
getId()
Get the id passed to the client.com.fasterxml.jackson.databind.JsonNode
getJsonMessage()
Get 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:
- Constant Field Values
-
CODE
"code"- See Also:
- Constant Field Values
-
MESSAGE
"message"- See Also:
- Constant Field Values
-
ERROR_BAD_PROPERTY_VALUE
"ErrorBadPropertyValue", a key for localized error messages indicating the value for the given property is not valid.- See Also:
- Constant Field Values
-
ERROR_MISSING_PROPERTY_PUT
"ErrorMissingPropertyPut", a key for localized error messages indicating a property required to complete a PUT request is missing.- See Also:
- Constant Field Values
-
ERROR_NOT_FOUND
"ErrorNotFound", a key for localized error messages indicating a resource was not found.- See Also:
- Constant Field Values
-
ERROR_OBJECT
"ErrorObject", a key for localized error messages indicating an inability to get a requested object.- See Also:
- Constant Field Values
-
ERROR_UNKNOWN_TYPE
"ErrorUnknownType", a key for localized error messages indicating the requested type cannot be handled.- See Also:
- Constant Field Values
-
LOGGED_ERROR
"LoggedError", a key for localized error messages indicating that JMRI logs contain required information to resolve the error.- See Also:
- Constant Field Values
-
-
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:
JsonHttpService
-
getJsonMessage
Get the JSON formatted error message.- Returns:
- the error message in a JSON format
-