Class SchemaException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ValidationException

public class SchemaException extends JsonValueException
Encapsulate a general JSON validator error.

If the validator needs to include information about a specific location in an JSON document, it should use the ValidationException subclass.

See Also:
  • Constructor Details

    • SchemaException

      public SchemaException(JsonValue value, String message)
      Create the exception with the given value and message.
      Parameters:
      value - The value.
      message - The message.
    • SchemaException

      public SchemaException(JsonValue value, String message, Throwable throwable)
      Create the exception with the given value, message and cause.
      Parameters:
      value - The value.
      message - The message.
      throwable - The cause.
    • SchemaException

      public SchemaException(JsonValue value, Exception e)
      Create a new SchemaException wrapping an existing exception.

      The existing exception will be embedded in the new one, and its message will become the default message for the SchemaException.

      Parameters:
      value - The value.
      e - The exception to be wrapped in a SchemaException.
    • SchemaException

      public SchemaException(JsonValue value, String message, Exception e)
      Create a new SchemaException from an existing exception.

      The existing exception will be embedded in the new one, but the new exception will have its own message.

      Parameters:
      value - The value.
      message - The detail message.
      e - The exception to be wrapped in a SchemaException.
  • Method Details

    • getMessage

      public String getMessage()
      Return a detail message for this exception.

      If there is an embedded exception, and if the SchemaException has no detail message of its own, this method will return the detail message from the embedded exception.

      Overrides:
      getMessage in class JsonValueException
      Returns:
      The error or warning message.
    • getException

      public Exception getException()
      Return the embedded exception, if any.
      Returns:
      The embedded exception, or null if there is none.
    • toString

      public String toString()
      Override toString to pick up any embedded exception.
      Overrides:
      toString in class Throwable
      Returns:
      A string representation of this exception.