MissingFieldException

Thrown when KSerializer did not receive a non-optional property from CompositeDecoder and CompositeDecoder.decodeElementIndex had already returned CompositeDecoder.DECODE_DONE.

MissingFieldException is thrown on missing field from all auto-generated serializers and it is recommended to throw this exception from user-defined serializers.

MissingFieldException is constructed from the following properties:

See also

Constructors

Link copied to clipboard
constructor(missingFields: List<String>, serialName: String)

Creates an instance of MissingFieldException for the given missingFields and serialName of the corresponding serializer.

constructor(missingField: String, serialName: String)

Creates an instance of MissingFieldException for the given missingField and serialName of the corresponding serializer.

Properties

Link copied to clipboard

List of fields that were required but not found during deserialization. Contains at least one element.

Link copied to clipboard

Returns a serial name of a serializable class that cannot be deserialized due to missing fields. Typically, equal to the SerialDescriptor.serialName of the serializable class.