Migration from apollo android to apollo kotlin

I am trying to migrate from apollo android to apollo 3.8.2

this is Error class from apollo kotlin

class Error( 
val message: String, 
val locations: List<Error.Location>?, 
val path: List<Any>?,
 val extensions: Map<String, Any?>?,
 val nonStandardFields: Map<String, Any?>? )

this is the error class in apollo android

Error(java.lang.String message, java.util.List<Error.Location> locations, java.util.Map<java.lang.String,java.lang.Object> customAttributes)

when there is an server exception like INVALID user id or anything like that, message field to be a null is a valid case because extensions include all information i need.
and it worked in apollo android 2.. but message field being null become invalid case for apollo kotlin which throws jsonDataException. is there any solution ?

Hi :wave:

GraphQL mandates that the message field is present. See GraphQL Spec:

Every error must contain an entry with the key message with a string description of the error

The easiest way forward is to change this on your server.

If you really can’t, a workaround is to rewrite your response to add a synthetic message field using an HTTP interceptor but this is going to be more fragile and probably harder to implement.