From affb5821342b91f4371fe79e82a6a28a54d97bc7 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Mon, 7 Nov 2011 18:05:35 +0000 Subject: Clean up docstrings for faults.Fault and it's usage Many extensions wrapped exceptions manually with faults.Fault and ther continues to be some confusion if it's necessary. This patch clears up what faults.Fault does as well as documents that wsgi.Resource automatically wraps webob.exc.HTTPException Change-Id: Ieed63b8641499bc7449bae2684d5f63e5839d369 --- nova/api/openstack/faults.py | 2 +- nova/api/openstack/wsgi.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/openstack/faults.py b/nova/api/openstack/faults.py index 0ef863eed..52d64c283 100644 --- a/nova/api/openstack/faults.py +++ b/nova/api/openstack/faults.py @@ -24,7 +24,7 @@ from nova.api.openstack import wsgi class Fault(webob.exc.HTTPException): - """An RS API fault response.""" + """Wrap webob.exc.HTTPException to provide API friendly response.""" _fault_names = { 400: "badRequest", diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index a3ca5cd5b..f96a12eab 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -527,6 +527,9 @@ class Resource(wsgi.Application): They may raise a webob.exc exception or return a dict, which will be serialized by requested content type. + Exceptions derived from webob.exc.HTTPException will be automatically + wrapped in faults.Fault() to provide API friendly error responses. + """ def __init__(self, controller, deserializer=None, serializer=None): -- cgit