[QUESTION] how to return multiple errors? #5666
Unanswered
leognmotta
asked this question in
Question
Replies: 1 comment
-
There's an open PR for allowing extensions to be passed in the error obj that would give more flexibility, but unfortunately it's been stale for months. #4351 |
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
-
I am using action to make form validation from my API with AdonisJS 5, some times form validations can result in multiple errors, from hasura actions docs errors are returned as object in the api:
https://hasura.io/docs/1.0/graphql/manual/actions/action-handlers.html
and hasura returns it as an array:
I tried many thinds already, but hasura expect message to be an object and the response to be an object not array. How can I improve user experience, showing all fields with errors? I am doing some gotacha, which is not something I want to do:
This way I can parse all errors and show to the user, but I really think there should be a better way, it just does not make sense for me returning errors as an array if I can only return I single error at once.
My final result:
Beta Was this translation helpful? Give feedback.
All reactions