DEV Community

Discussion on: Return well-formed error responses from your REST APIs

Collapse
 
rhymes profile image
rhymes

Thanks, I've been meaning to research how to enrich my response errors.

I mostly use the combination of HTTP status code + error message in JSON now but I want to explore how to provide more information to the client without breaking compatibility.

How do you deal with the situation where there are multiple errors? Do you send back a list of errors or a generic one?

Collapse
 
suhas_chatekar profile image
Suhas Chatekar

You may have noticed in the example JSON I used in the post that the response is always an array. So if there are more than one errors then we just add those many entries of error object in the array.

Collapse
 
rhymes profile image
rhymes

sorry, I missed that!

Thanks!