nova/releasenotes/notes/placement-error-code-fcbbf5d45560984e.yaml

10 lines
410 B
YAML
Raw Normal View History

Provide framework for setting placement error codes The API-sig has a guideline[1] for including error codes in error responses to help distinguish errors with the same status code from one another. This change provides a simplest-thing-that-could- possibly-work solution to make that go. This solution comes about after a few different constraints and attempts: * We would prefer to go on using the existing webob.exc exceptions, not make subclasses. * We already have a special wrapper around our wsgi apps to deal with setting the json_error_formatter. * Though webob allows custom Request and Response objects, it uses the default Response object as the parent of the HTTP exceptions. * The Response object accepts kwargs, but only if they can be associated with known attributes on the class. Since we can't subclass... * The json_error_formatter method is not passed the raw exception, but it does get the current WSGI environ * The webob.exc classes take a 'comment' kwarg that is not used, but is also not passed to the json_error_formatter. Therefore, when we raise an exception, we can set 'comment' to a code and then assign that comment to a well known field in the environ and if that environ is set in json_error_formatter, we can set 'code' in the output. This is done in a new microversion, 1.23. Every response gets a default code 'placement.undefined_code' from 1.23 on. Future development will add specific codes where required. This change adds a stub code for inventory in use when doing a PUT to .../inventories but the name may need improvement. [1] http://specs.openstack.org/openstack/api-wg/guidelines/errors.html Implements blueprint placement-api-error-handling Change-Id: I9a833aa35d474caa35e640bbad6c436a3b16ac5e
2018-02-20 15:10:25 +00:00
---
features:
- |
In microversion 1.23 of the placement service, JSON formatted error
responses gain a new attribute, ``code``, with a value that identifies the
type of this error. This can be used to distinguish errors that are
different but use the same HTTP status code. Any error response which does
not specifically define a code will have the code
``placement.undefined_code``.