ansman/kotshi

Error handling

v-grishechko opened this issue · 2 comments

I need the opinion about error handling. Will be great if in the library will be a way to handle errors during parsing.

For example, if json doesn't contain the field, which must be in data class (non-nullable), or json corrupted, don't throw Exception. Instead of this, return null in the adapter, but exception pass to some utility class of Kotshi. And in utility class add the method for registering error handlers.

This feature gives the ability to react to exceptions in depend on the type of build. For example, in debug build throw exception, but in release build, ignore this exception and only send error in analytics.

This sounds more like a feature that would belong in Moshi rather than Kotshi.

Kotshi will not do something radically different than Moshi. As a workaround you could wrap the JsonAdapter that the Kotshi factory returns.

Ok, thank you.