diff options
author | Vsevolod Tolstopyatov <qwwdfsad@gmail.com> | 2023-10-10 09:59:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 09:59:19 +0200 |
commit | 79ecba6e813cc0d59758c9d3f229288b6bd90e8a (patch) | |
tree | 1b4383e1283e7cd2244036e69bbab518f29e9f14 | |
parent | 7b75e39ae6837bfad04d0d18b24bd0facbf9e63c (diff) | |
download | kotlinx.serialization-79ecba6e813cc0d59758c9d3f229288b6bd90e8a.tar.gz |
Update MissingFieldException documentation (#2465)
-rw-r--r-- | core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt b/core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt index 7af9d9a4..99f7d0a7 100644 --- a/core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt +++ b/core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt @@ -5,6 +5,7 @@ package kotlinx.serialization import kotlinx.serialization.encoding.* +import kotlinx.serialization.descriptors.* /** * A generic exception indicating the problem in serialization or deserialization process. @@ -65,6 +66,12 @@ public open class SerializationException : IllegalArgumentException { * [MissingFieldException] is thrown on missing field from all [auto-generated][Serializable] serializers and it * is recommended to throw this exception from user-defined serializers. * + * [MissingFieldException] is constructed from the following properties: + * - [missingFields] -- fields that were required for the deserialization but have not been found. + * They are always non-empty and their names match the corresponding names in [SerialDescriptor.elementNames] + * - Optional `serialName` -- serial name of the enclosing class that failed to get deserialized. + * Matches the corresponding [SerialDescriptor.serialName]. + * * @see SerializationException * @see KSerializer */ |