All REST API endpoints can return 400- or 500-level errors with a generic JSON object. It is not an "exceptional" case when this happens. We don't necessarily want to throw control back up to some arbitrary caller. We should try to handle these errors in normal control flow rather than in a catch block. We can still throw if the API response is out of spec (e.g. malformatted JSON).
The returned JSON structure is the same for all:
{
"code": "",
"details": "",
"message": ""
}
Special handling should be considered for certain codes. For example, see #14.
All REST API endpoints can return 400- or 500-level errors with a generic JSON object. It is not an "exceptional" case when this happens. We don't necessarily want to throw control back up to some arbitrary caller. We should try to handle these errors in normal control flow rather than in a
catch
block. We can still throw if the API response is out of spec (e.g. malformatted JSON).The returned JSON structure is the same for all:
Special handling should be considered for certain codes. For example, see #14.