Class JsonDeserializationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
name.martingeisse.grumpyjson.deserialize.JsonDeserializationException
- All Implemented Interfaces:
Serializable
This exception type gets thrown when the incoming JSON does not match the expected structure.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an exception for a single-field error caused by an exception from the deserializer.JsonDeserializationException(String message) Creates an exception for a single error message without a field path.JsonDeserializationException(FieldErrorNode fieldErrorNode) Creates an exception for aFieldErrorNodethat wraps one or more actual errors. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
JsonDeserializationException
Creates an exception for a single error message without a field path. This constructor is typically used inJsonDeserializer.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
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
NullableFieldConverterandOptionalFieldConverter.- Parameters:
cause- the exception to wrap- See Also:
-
JsonDeserializationException
Creates an exception for aFieldErrorNodethat 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
RecordConverterandListConverter.- Parameters:
fieldErrorNode- the node that contains one or more actual errors
-
-
Method Details
-
getFieldErrorNode
Getter for theFieldErrorNodethat holds the actual error(s)- Returns:
- the field error node
-
getMessage
- Overrides:
getMessagein classThrowable
-