Package org.springframework.graphql
Interface ResponseError
public interface ResponseError
Represents a GraphQL response error.
- Since:
- 1.0
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescriptionReturn a classification for the error that is specific to GraphQL Java.Return a map with GraphQL Java and other implementation specific protocol error detail extensions such asgetErrorType()
, possibly empty.Return a list of locations in the GraphQL document, if the error can be associated to a particular point in the document.Return the message with a description of the error intended for the developer as a guide to understand and correct the error.Return the path to a response field which experienced the error, if the error can be associated to a particular field in the result, or otherwise an empty list.getPath()
Return a String representation of theparsed path
, or an empty String if the error is not associated with a field.
-
Method Details
-
getMessage
Return the message with a description of the error intended for the developer as a guide to understand and correct the error. -
getErrorType
ErrorClassification getErrorType()Return a classification for the error that is specific to GraphQL Java. This is serialized under"extensions"
in the response map. -
getPath
String getPath()Return a String representation of theparsed path
, or an empty String if the error is not associated with a field.Example paths:
"hero" "hero.name" "hero.friends" "hero.friends[2]" "hero.friends[2].name"
-
getParsedPath
Return the path to a response field which experienced the error, if the error can be associated to a particular field in the result, or otherwise an empty list. This allows a client to identify whether anull
result is intentional or caused by an error.This list contains path segments starting at the root of the response and ending with the field associated with the error. Path segments that represent fields are strings, and path segments that represent list indices are 0-indexed integers. If the error happens in an aliased field, the path uses the aliased name, since it represents a path in the response, not in the request.
-
getLocations
List<SourceLocation> getLocations()Return a list of locations in the GraphQL document, if the error can be associated to a particular point in the document. Each location has a line and a column, both positive, starting from 1 and describing the beginning of an associated syntax element. -
getExtensions
Return a map with GraphQL Java and other implementation specific protocol error detail extensions such asgetErrorType()
, possibly empty.
-