Class JsonException

All Implemented Interfaces:
Serializable

public class JsonException
extends Exception
Throw an exception, but include an HTTP error code.
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • JsonException

      public JsonException​(int code, String message, Throwable throwable, int id)
      Create an exception that can be passed to a JSON client.
      Parameters:
      code - the error code
      message - message, displayable to the user, in the client's preferred locale
      throwable - the cause of the exception
      id - 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 code
      message - message, displayable to the user, in the client's preferred locale
      throwable - the cause of the exception
      additionalData - additional data to be passed to the client
      id - the message id passed by the client, or the additive inverse of that id
    • JsonException

      public JsonException​(int code, Throwable throwable, int id)
      Create an exception that can be passed to a JSON client.
      Parameters:
      code - the error code
      throwable - the cause of the exception
      id - 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 code
      throwable - the cause of the exception
      additionalData - additional data to be passed to the client
      id - the message id passed by the client, or the additive inverse of that id
    • JsonException

      public JsonException​(int code, String message, int id)
      Create an exception that can be passed to a JSON client.
      Parameters:
      code - the error code
      message - message, displayable to the user, in the client's preferred locale
      id - 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 code
      message - message, displayable to the user, in the client's preferred locale
      additionalData - additional data to be passed to the client
      id - the message id passed by the client, or the additive inverse of that id
  • Method Details

    • 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