Commit 03a881e
Update default exception handler to use SimpleKotlinGraphQLError (#369)
By default, our default exception handler was wrapping all the runtime exceptions in `graphql-java` `ExceptionWhileDataFetching` GraphQLError. Since this default GraphQL error exposes `exception` field it was also getting serialized in the response. While this is was still valid GraphQL response, per [spec](https://graphql.github.io/graphql-spec/June2018/#sec-Errors) `exception` field is not part of the defined error fields and instead should be included in the error `extensions` entry field instead (if at all).
Note: the above serialization issue could also be solved by using `graphql-java` `ExecutionResult#toSpecification` method to generate final results but that would also imply that we would need to return `Map` instead of a `GraphQLResponse`.1 parent 50f3792 commit 03a881e
File tree
3 files changed
+6
-5
lines changed- examples/spring/src/main/kotlin/com/expediagroup/graphql/sample
- exceptions
- query
- graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/spring/exception
3 files changed
+6
-5
lines changedLines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | | - | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
0 commit comments