Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ariadne's documentation is rightfully opinionated on the communication of exceptions from the server and strongly suggests protecting the errors key. It rightfully suggests replacing the default error formatter. To date, no preexisting sanely configured, easily overridable solution exists for communicating messages to users in the event of validation errors or other common problematic workflows (e.g. normal 401/403 type events).
In this PR, I have provided a simple solution that includes short, descriptive error messaging tied to HTTP-style messages for errors. I have also provided a path for user facing error messaging to be communicated. Communicating client-facing errors from server to client is a normal expectation, and providing a field exclusively for that allows for client-side developers to easily distinguish between GraphQL errors that are NOT user facing and ValidationErrors, etc. that most assuredly are.
Fair credit to the following post for providing some inspiration:
https://medium.com/@tarkus/validation-and-user-errors-in-graphql-mutations-39ca79cd00bf
The major difference is I use "non_field_errors" instead of "", which both makes intent more clear and follows standard django patterns.
Documentation PR: mirumee/ariadne-website#58