Class JsonDeserializationException

java.lang.Object
java.lang.Throwable
java.lang.Exception
name.martingeisse.grumpyjson.deserialize.JsonDeserializationException
All Implemented Interfaces:
Serializable

public class JsonDeserializationException extends Exception
This exception type gets thrown when the incoming JSON does not match the expected structure.
See Also:
  • Constructor Details

    • JsonDeserializationException

      public JsonDeserializationException(String message)
      Creates an exception for a single error message without a field path. This constructor is typically used in JsonDeserializer.deserialize(JsonElement, Type) for a JSON primitive, such as a parser for a custom date format that has encountered a string which does not match the expected pattern.
      Parameters:
      message - the error message
      See Also:
    • JsonDeserializationException

      public JsonDeserializationException(Exception cause)
      Creates an exception for a single-field error caused by an exception from the deserializer. Application code will rarely use this constructor directly because it can just throw that exception and have the framework wrap it. It is only needed when implementing deserializers for custom structured types or custom wrapper types, to implement the catch-and-wrap there.

      For examples on how this method is useful, see NullableFieldConverter and OptionalFieldConverter.

      Parameters:
      cause - the exception to wrap
      See Also:
    • JsonDeserializationException

      public JsonDeserializationException(FieldErrorNode fieldErrorNode)
      Creates an exception for a FieldErrorNode that wraps one or more actual errors. Application code will usually not call this method directly. It is only needed when implementing deserializers for custom structured types, to re-throw after the individual field errors have been combined and field paths applied.

      For an example on how this method is useful, see RecordConverter and ListConverter.

      Parameters:
      fieldErrorNode - the node that contains one or more actual errors
  • Method Details