Skip to content
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

Predictable error format #904

Open
geromegrignon opened this issue Mar 24, 2022 · 1 comment
Open

Predictable error format #904

geromegrignon opened this issue Mar 24, 2022 · 1 comment

Comments

@geromegrignon
Copy link
Contributor

first of all , nice job and good luck to you , your api are being used for recruiting team couples of days ago so lots of people will be happy to hear your good news.
about the error handling what I have seen in other teams is that they have a simple error object with a text in it conveying the error . now handling couples of error at the same time might be subjective ! You can still send back an error object with just text , so in front end they can render all of them with a simple loop , or just send back the first error , cause at then end of the they showing 3 errors in a blink of an eye cannot be so good for ux . the important thing is that you always have the object name and structure for the errors that you send to the client (it should be Predictable !!
this is how errors look like in client
image

In my idea the best and easiest way is that just send the error string in this case : 'title must be uniqe'
right now is error object then name of the error field ( which is Predictable ) and an array!!! of what went wrong
if you want to handle multiple errors you can do : errors:[ 'title required ' , 'name required ' ]
single error , error: 'name required'

Originally posted by @hosseinghs in #900 (comment)

@geromegrignon
Copy link
Contributor Author

@ hosseinghs i opened a dedicated issue.

I share your feelings about the current error format.
By working on the next version of the specs I'll care about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant