Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Best way to handle errors in resolvers? #731

Closed
Dreamystify opened this issue Dec 18, 2020 · 3 comments
Closed

Best way to handle errors in resolvers? #731

Dreamystify opened this issue Dec 18, 2020 · 3 comments
Labels

Comments

@Dreamystify
Copy link

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?

@danielrearden
Copy link
Collaborator

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.

@Dreamystify
Copy link
Author

The schema is valid but it still returns the 500 error with the errors array

@ParallelUniv3rse
Copy link

related issue: #427

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants