[openstack-dev] [all] [api] Erring is Caring
everett.toews at RACKSPACE.COM
Tue Mar 31 21:36:14 UTC 2015
An API Working Group Guideline for Errors
Errors are a crucial part of the developer experience when using an API. As developers learn the API they inevitably run into errors. The quality and consistency of the error messages returned to them will play a large part in how quickly they can learn the API, how they can be more effective with the API, and how much they enjoy using the API.
We need consistency across all services for the error format returned in the response body.
The Way Forward
I did a bit of research into the current state of consistency in errors across OpenStack services . Since no services seem to respond with a top-level "errors" key, it's possible that they could just include this key in the response body along with their usual response and the 2 can live side-by-side for some deprecation period. Hopefully those services with unstructured errors should okay with adding some structure. That said, the current error formats aren't documented anywhere that I've seen so this all feels fair game anyway.
How this would get implemented in code is up to you. It could eventually be implemented in all projects individually or perhaps a Oslo utility is called for. However, this discussion is not about the implementation. This discussion is about the error format.
I’ve explicitly added all of the API WG and Logging WG CPLs as reviewers to that patch but feedback from all is welcome. You can find a more readable version of patch set 4 at . I see the "id" and “code” fields as the connection point to what the logging working group is doing.
More information about the OpenStack-dev