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