You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m trying to catch a deserialization error (from a call like this: Json.decodeFromString<Foo>("...")) and transform it into a pure value (e.g. Either<JsonDeserializationFailure, Foo>). But I couldn’t find a solution, I don’t want to catch a wide-scoped Exception that can be totally not related to deserialization issue. I see that the library throws kotlinx.serialization.json.internal.JsonDecodingException but I can’t access it because it’s internal. How is it supposed to be done?
I went through a bunch of articles about kotlinx.serialization but apparently none of them are talking about errors handling which leaves me confused.
The text was updated successfully, but these errors were encountered:
@sandwwraith Just note that require throws IllegalArgumentException (check throws IllegalStateException). In this case require/IllegalArgumentException would be the appropriate exceptions as it is "input" validation.
I’m trying to catch a deserialization error (from a call like this:
Json.decodeFromString<Foo>("...")
) and transform it into a pure value (e.g.Either<JsonDeserializationFailure, Foo>
). But I couldn’t find a solution, I don’t want to catch a wide-scopedException
that can be totally not related to deserialization issue. I see that the library throwskotlinx.serialization.json.internal.JsonDecodingException
but I can’t access it because it’s internal. How is it supposed to be done?I went through a bunch of articles about kotlinx.serialization but apparently none of them are talking about errors handling which leaves me confused.
The text was updated successfully, but these errors were encountered: