Skip to content

Commit 79ecba6

Browse files
authored
Update MissingFieldException documentation (#2465)
1 parent 7b75e39 commit 79ecba6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package kotlinx.serialization
66

77
import kotlinx.serialization.encoding.*
8+
import kotlinx.serialization.descriptors.*
89

910
/**
1011
* A generic exception indicating the problem in serialization or deserialization process.
@@ -65,6 +66,12 @@ public open class SerializationException : IllegalArgumentException {
6566
* [MissingFieldException] is thrown on missing field from all [auto-generated][Serializable] serializers and it
6667
* is recommended to throw this exception from user-defined serializers.
6768
*
69+
* [MissingFieldException] is constructed from the following properties:
70+
* - [missingFields] -- fields that were required for the deserialization but have not been found.
71+
* They are always non-empty and their names match the corresponding names in [SerialDescriptor.elementNames]
72+
* - Optional `serialName` -- serial name of the enclosing class that failed to get deserialized.
73+
* Matches the corresponding [SerialDescriptor.serialName].
74+
*
6875
* @see SerializationException
6976
* @see KSerializer
7077
*/

0 commit comments

Comments
 (0)