Class GraphQLRequestExecutionException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.graphql_java_generator.exception.GraphQLRequestExecutionException
- All Implemented Interfaces:
GraphQLRequestExecutionExceptionInterface
,Serializable
public class GraphQLRequestExecutionException
extends Exception
implements GraphQLRequestExecutionExceptionInterface
Thrown when an error occurs during the request execution. This is typically when :
- One or more Bind Variable are missing
- When an error occurred on server side. In this case (and only in this case), the
getErrors()
method returns non null value. This value is the server errors list.
- Author:
- etienne-sf
- See Also:
-
Constructor Summary
ConstructorDescriptionGraphQLRequestExecutionException
(String msg, Throwable cause) GraphQLRequestExecutionException
(List<org.springframework.graphql.ResponseError> errors, Object data, org.springframework.graphql.client.ClientGraphQlResponse response) Generates a new instance, from a non empty and non null list ofGraphQLError
-
Method Summary
Modifier and TypeMethodDescriptiongetData()
Retrieves the data part of the response: it may contain valid data, even if when the server sent errors back, for instance if multiple fields of a query or a mutation are requestedList<org.springframework.graphql.ResponseError>
Allows to retrieve the list of error that have been received from the GraphQL serverorg.springframework.graphql.client.ClientGraphQlResponse
Get the full server response, for further investigation.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
GraphQLRequestExecutionException
-
GraphQLRequestExecutionException
-
GraphQLRequestExecutionException
public GraphQLRequestExecutionException(List<org.springframework.graphql.ResponseError> errors, Object data, org.springframework.graphql.client.ClientGraphQlResponse response) Generates a new instance, from a non empty and non null list ofGraphQLError
- Parameters:
errors
- A list of GraphQL error messagesdata
- the data returned by the server, parsed by the plugin into the generated POJO that match the GraphQL schema. For instance, when executing a full query that requests to query's field, it can for instance contain the valid response data for one, while there is an error for the second queried field.
-
-
Method Details
-
getErrors
Description copied from interface:GraphQLRequestExecutionExceptionInterface
Allows to retrieve the list of error that have been received from the GraphQL server- Specified by:
getErrors
in interfaceGraphQLRequestExecutionExceptionInterface
-
getData
Description copied from interface:GraphQLRequestExecutionExceptionInterface
Retrieves the data part of the response: it may contain valid data, even if when the server sent errors back, for instance if multiple fields of a query or a mutation are requested- Specified by:
getData
in interfaceGraphQLRequestExecutionExceptionInterface
-
getResponse
public org.springframework.graphql.client.ClientGraphQlResponse getResponse()Description copied from interface:GraphQLRequestExecutionExceptionInterface
Get the full server response, for further investigation.- Specified by:
getResponse
in interfaceGraphQLRequestExecutionExceptionInterface
- Returns:
-