Best way to handle errors in resolvers?
Dreamystify opened this issue · 3 comments
I have built a graphql server with throwing errors which returns the errors with a 500 status. I also have a ios app with apollo consuming the graphql server. Problem is apollo cant read the errors from the failed function caused by 500 status. Is there a way to change the 500 status code to 4xx?
The only time express-graphql
will throw 500 errors is if the schema itself is invalid. Arguably, if the schema is invalid, your server shouldn't start to begin with. You can manually call validateSchema
on your schema before starting your server and exit your process with an error if any errors are returned.
Issues are used for bug reporting and features only. If you have additional questions, please ask them in Stack Overflow or the community Slack channel.
The schema is valid but it still returns the 500 error with the errors array
related issue: #427