Catch graphql errors in resolver instead of returning #715
ehsanonline
started this conversation in
General
Replies: 1 comment
-
Those errors aren't reported down the query execution stack, so you can't access them in resolvers. Consider errors coming from GraphQL's validation as signal that either validation in the client needs to be improved, or client itself has errors that need to be corrected. Its generally better idea to rely on GraphQL validation for data type/shape, and validating values against business logic in resolvers themselves. I've been discussing this in my recent GraphQL Wrocław talk (21:54 - Put most of your validation into resolvers). As a bonus, this talk goes into reporting errors too. |
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
-
How can I get graphql validations errors in resolver
info
? Then I decide to return it or not.It will be useful to make a good error pattern, for instance using pydantic which is better, then check for graphql errors.
thank you.
Beta Was this translation helpful? Give feedback.
All reactions