We are writing a REST API that performs validation up-front. The code is written such that it tries to find as many errors as possible. However, each error might correspond to a different HTTP status code. Additionally, the client (the HTML) doesn't have a convenient way to parse/display the errors.
Is it better to just throw as soon as the first error occurs? Or should we do our best to aggregate the errors somehow? By the way, there is no requirement to try to handle as many as possible at once.
I am not looking for an opinion. I was curious if there was a standard practice in REST.
Why It Matters
The current code is really complex. Some validation can only be run if other pieces are valid. So there is this explicit dependency between tests. It is complex enough that it warrants using a 3rd-party library. But I would rather just eliminate the cause of the complexity if I am going to spend time on it.