You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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'
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
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)
The text was updated successfully, but these errors were encountered: