This repository was archived by the owner on Dec 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
graphql-kickstart-spring-support/src/main/java/graphql/kickstart/spring/error Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 11package graphql .kickstart .spring .error ;
22
3+ import graphql .ErrorClassification ;
34import graphql .language .SourceLocation ;
45
56import java .util .List ;
7+ import java .util .Map ;
68
79public class ErrorContext {
810 private final List <SourceLocation > locations ;
911 private final List <Object > path ;
12+ private final Map <String , Object > extensions ;
13+ private final ErrorClassification errorType ;
1014
11- public ErrorContext (List <SourceLocation > locations , List <Object > path ) {
15+ public ErrorContext (List <SourceLocation > locations ,
16+ List <Object > path ,
17+ Map <String , Object > extensions ,
18+ ErrorClassification errorType ) {
1219 this .locations = locations ;
1320 this .path = path ;
21+ this .extensions = extensions ;
22+ this .errorType = errorType ;
1423 }
1524
1625 public List <SourceLocation > getLocations () {
@@ -20,4 +29,12 @@ public List<SourceLocation> getLocations() {
2029 public List <Object > getPath () {
2130 return path ;
2231 }
32+
33+ public Map <String , Object > getExtensions () {
34+ return extensions ;
35+ }
36+
37+ public ErrorClassification getErrorType () {
38+ return errorType ;
39+ }
2340}
Original file line number Diff line number Diff line change @@ -32,7 +32,12 @@ protected List<GraphQLError> filterGraphQLErrors(List<GraphQLError> errors) {
3232 }
3333
3434 private Collection <GraphQLError > transform (GraphQLError error ) {
35- ErrorContext errorContext = new ErrorContext (error .getLocations (), error .getPath ());
35+ ErrorContext errorContext = new ErrorContext (
36+ error .getLocations (),
37+ error .getPath (),
38+ error .getExtensions (),
39+ error .getErrorType ()
40+ );
3641 return extractException (error ).map (throwable -> transform (throwable , errorContext ))
3742 .orElse (singletonList (new GenericGraphQLError (error .getMessage ())));
3843 }
You can’t perform that action at this time.
0 commit comments