Hi, we’re working to improve our application’s behavior during error conditions.
The general error page for the Content Management API is nice: https://www.datocms.com/docs/content-management-api/errors but there doesn’t seem to exist such a page for the Content Delivery API. That would be useful, especially if it also included HTTP codes, to get more information about possible error states.
Knowing at least some of the main error codes would help us build a robust application that can properly explain potential errors for users and inform our developers on how to react when facing errors.
Just a note that we will be discussing this internally soon. It’s a good idea, but also a complex enough project that we’ll have to scope it out and figure out how to best go about doing this. I’ll provide updates when I can!
Please note that because there are many different possible errors, you should check for HTTP response code != 2xx and then parse the JSON body’s data.map(error => error.code) for the actual error. An example error response might look like:
I clarified the situation with the HTTP codes, by the way. The overwhelming majority of them will return a 4xx, and only rarely a 5xx (generally an unhandled/unexpected error of some sort). It’s still safer to check for !2xx rather than specifically a 4xx or 5xx. And rather than parsing the HTTP status code, it will be more informative to parse the attributes.code in the JSON body and reference that against either the human-readable error codes documentation or the machine-parseable JSON version of the same codes.