-
-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a general error formateer #1510
Labels
question
Further information is requested
Comments
I have approached the same problem with a different solution: don't touch the transport ( mutation {
registerUser(email: ..., password: ...) {
errors # Any or custom Error scalar
user { id }
}
} {
"data": {
"registerUser": {
"errors": [{ "code": "INVALID_EMAIL", ... }, { "code": "MIN_LENGH", ... }],
"user": null
}
},
"error": null,
"extensions": null
}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there any way to centralize every error format for the whole schema? I'm guessing about a middleware similar to:
I hope to be able to send something concise to the client, like:
But not being forced to manually handle the same validation errors repeatedly on each resolver.
I've tried using validation middleware, but the error is already formatted, and it's hard to obtain error granular info and a unique code for each error.
The text was updated successfully, but these errors were encountered: