GraphError
Deprecated
Legacy serializer-coupled GraphQL error. Use GraphQLResponseError from the backend-neutral GraphQLResponse contract instead.
GraphQL error representation that is spec compliant.
Legacy: this serializer-coupled error type lives in :compat for the deprecated GraphContainer/co.anitrend.retrofit.graphql.converter.GraphConverter flow. New code should use the backend-neutral co.anitrend.retrofit.graphql.model.GraphQLResponseError instead.
Annotated with kotlinx.serialization.Serializable to enable deserialization as part of GraphContainer.errors when using kotlinx.
Serialization Behavior
kotlinx.serialization
path is
@Transient(excluded) becauseList<Any>cannot be statically resolved by the kotlinx compiler pluginextensions is
@Transient(excluded) becauseMap<String, Any?>cannot be statically resolved by the kotlinx compiler plugin
Gson (via GsonGraphQLJson)
All fields are serialized/deserialized normally, including path and extensions
Accessing path and extensions with kotlinx
To read path or extensions while using kotlinx serialization, define your own @Serializable transport error class with concrete JSON element types. No custom serializer is required unless the actual wire structure needs transformation:
@Serializable
data class JsonGraphError(
val message: String? = null,
val path: List<JsonElement>? = null,
val locations: List<GraphError.Location>? = null,
val extensions: JsonObject? = null,
)Alternatively, extract path and extensions from the raw JsonObject payload before kotlinx deserialization runs.
Parameters
Description of the error.
Path of the response field that encountered the error. Gson-only; @Transient for kotlinx.
List of locations within the GraphQL document at which the error occurred.
Additional information about the error. Gson-only; @Transient for kotlinx.