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 1
1
package graphql .kickstart .spring .error ;
2
2
3
+ import graphql .ErrorClassification ;
3
4
import graphql .language .SourceLocation ;
4
5
5
6
import java .util .List ;
7
+ import java .util .Map ;
6
8
7
9
public class ErrorContext {
8
10
private final List <SourceLocation > locations ;
9
11
private final List <Object > path ;
12
+ private final Map <String , Object > extensions ;
13
+ private final ErrorClassification errorType ;
10
14
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 ) {
12
19
this .locations = locations ;
13
20
this .path = path ;
21
+ this .extensions = extensions ;
22
+ this .errorType = errorType ;
14
23
}
15
24
16
25
public List <SourceLocation > getLocations () {
@@ -20,4 +29,12 @@ public List<SourceLocation> getLocations() {
20
29
public List <Object > getPath () {
21
30
return path ;
22
31
}
32
+
33
+ public Map <String , Object > getExtensions () {
34
+ return extensions ;
35
+ }
36
+
37
+ public ErrorClassification getErrorType () {
38
+ return errorType ;
39
+ }
23
40
}
Original file line number Diff line number Diff line change @@ -32,7 +32,12 @@ protected List<GraphQLError> filterGraphQLErrors(List<GraphQLError> errors) {
32
32
}
33
33
34
34
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
+ );
36
41
return extractException (error ).map (throwable -> transform (throwable , errorContext ))
37
42
.orElse (singletonList (new GenericGraphQLError (error .getMessage ())));
38
43
}
You can’t perform that action at this time.
0 commit comments