How does one catch JsonDecodingException? seems li...
# serialization
b
How does one catch JsonDecodingException? seems like it is internal to kotlinx
I guess you just have to catch a SerializationException…
v
Yeah, we recommend working with
SerializationException
instead,
JsonDecodingException
is just for better debuggability and diagnostics, not for programmatic use
b
I was using that for a tryMultipleTimes<T>(times: Int, exceptions:
List<KClass<out Exception>>
, f: ()->T):T
that would retry a certain number of times if it receive an exception from that list
but I can't do it with JsonDecodingException as I was doing:
listExceptions.any { e::class == it }
I added a "text" based selector based on the java qualified so I can still catch that one, not the best way, but I'm not certain how to do that better.
I could also catch and re throw my own exception I guess