4 ms·
> Normally you should attempt to find all the corner cases and present the errors to the user -- before processing the request. That is what they are suggestin
by fmbb 2y ago
> Normally you should attempt to find all the corner cases and present the errors to the user -- before processing the request.
That is what they are suggesting. You check the request and return 400 if it’s bad.
- bb88 2y agoOne example of a 500 error is a null pointer error. Was it a bad request or a logic error? One is your problem the other is not. Just returning a 400 hides that issue. Validating the payload before processing it simplifies the issue for everyone involved. A 500 error should be your problem with a stack trace in the log. A 400 error should provide enough description to tell the user it's theirs and how to fix it. Just marking recoding a 500 to a 400 because of a null pointer error would get noticed on a code review and marked up on a code review.
- bdangubic 2y ago400 - you fucked up 500 - we fucked up