-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: GraphQLJavaErrorInstrumentation changes error type of DataFetchingException #1932
Comments
Hi @hpuac, thank you for the feedback and report. To make sure I'm understanding: the use case is, in the case of a customized |
Hello, I replicated the behavior via this datafetcher, let me know if it's a different case:
In the linked PR, the goal was to make error reporting more consistent in the framework and it closed a gap that was there previously, which is where your bug report comes in. |
Hi @kailyak, Referring to the snippet shared in the original issue message: Lines 56 to 57 in f9382bf
I believe the dgs-framework/graphql-error-types/src/main/java/com/netflix/graphql/types/errors/ErrorDetail.java Line 151 in 8dd6966
Is this the expected behaviour for all |
This is also causing problems for us, we have our own error shape. Setting Could there be an option to make the typed error mapping configurable? |
@mrvaruntandon - you are right in that setting the ErrorDetail to SERVICE_ERROR, the INTERNAL error type is overridden and always set as UNAVAILABLE. This can be easily fixed by adding a new code for the ErrorDetail - perhaps one for describing Data fetching exceptions specifically. @djlfb - The framework generally is expected to convert all errors to a TypedGraphQLError. The It is easy enough to make Lastly, to address the original question in the issue from @hpuac - it is intentional to override the original error type and set it to INTERNAL in the case of data fetching exceptions. Is that not descriptive enough? We could also consider introducing a new ErrorDetail code, e.g. DATAFETCHER_ERROR. |
@srinivasankavitha I appreciate the rationale, but for us it isn't ideal. We have our own By setting a new |
For your use case, we could make this particular instrumentation configurable so you can disable it. @paulbakker - thoughts? |
Hey folks, I'd like to report a change in behavior that I currently consider a bug. It was introduced in 8.6.0 with this PR: #1905.
Please let me know your opinion on this topic 🙂
Expected behavior
When returning a
DataFetcherResult
containing aGraphQLError
I'm expecting my error to be propagated to the client, including my givencode
anderrorType
.Actual behavior
The
GraphQLJavaErrorInstrumentation
is creating a newTypedGraphQLError
and overriding theerrorType
.The
code
is kept but theerrorType
is overridden.See
dgs-framework/graphql-dgs/src/main/kotlin/com/netflix/graphql/dgs/internal/GraphQLJavaErrorInstrumentation.kt
Lines 53 to 57 in f9382bf
Steps to reproduce
Return a
DataFetcherResult
that contains a customGraphQLError
.Let me know in case you would like to see a demo project.
The text was updated successfully, but these errors were encountered: