Replies: 2 comments 3 replies
-
|
You can implement a custom exception handler and update the errors in the
response:
https://netflix.github.io/dgs/error-handling/#mapping-custom-exceptions
…On Tue, May 10, 2022 at 4:05 AM Sonali Sharma ***@***.***> wrote:
I want to change the error code from 200 to 400 for instances where an
invalid query is requested. I know I can see the errors field in the
response but I want to change the status code. How can I achieve this?
—
Reply to this email directly, view it on GitHub
<#1039>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJ5JPXPNSUF6QNQSVJ3UWYDVJI7I7ANCNFSM5VRGRZFA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
3 replies
-
If the query is incorrect (e.g. incorrect syntax) it should be 400 already. Which is implemented here: https://github.com/Netflix/dgs-framework/blob/master/graphql-dgs-spring-webmvc/src/main/kotlin/com/netflix/graphql/dgs/mvc/DgsRestController.kt#L122 However, for a query where there are just some fields that have errors, it would be against the GraphQL spec to fail the request completely, because you can have a mix of successful and error fields. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to change the error code from 200 to 400 for instances where an invalid query is requested. I know I can see the errors field in the response but I want to change the status code. How can I achieve this?
Beta Was this translation helpful? Give feedback.
All reactions