diff --git a/zaqar/tests/unit/transport/wsgi/v1/test_queue_lifecycle.py b/zaqar/tests/unit/transport/wsgi/v1/test_queue_lifecycle.py index 02fbdf166..0e39b898c 100644 --- a/zaqar/tests/unit/transport/wsgi/v1/test_queue_lifecycle.py +++ b/zaqar/tests/unit/transport/wsgi/v1/test_queue_lifecycle.py @@ -22,7 +22,7 @@ from zaqar.tests.unit.transport.wsgi import base @ddt.ddt -class TestQueueLifecycleMongoDB(base.V1BaseFaulty): +class TestQueueLifecycleMongoDB(base.V1Base): config_file = 'wsgi_mongodb.conf' diff --git a/zaqar/transport/wsgi/driver.py b/zaqar/transport/wsgi/driver.py index 7e2e2e6a5..28f58f145 100644 --- a/zaqar/transport/wsgi/driver.py +++ b/zaqar/transport/wsgi/driver.py @@ -19,6 +19,7 @@ from wsgiref import simple_server import falcon from oslo_config import cfg from oslo_log import log as logging +import six from zaqar.common import decorators from zaqar.common.transport.wsgi import helpers @@ -98,6 +99,7 @@ class Driver(transport.DriverBase): ]) self.app = falcon.API(before=self.before_hooks) + self.app.add_error_handler(Exception, self._error_handler) for version_path, endpoints in catalog: for route, resource in endpoints: @@ -115,6 +117,13 @@ class Driver(transport.DriverBase): self.app = auth.SignedHeadersAuth(self.app, auth_app) + def _error_handler(self, exc, request, response, params): + if isinstance(exc, falcon.HTTPError): + raise exc + LOG.exception(exc) + raise falcon.HTTPInternalServerError('Internal server error', + six.text_type(exc)) + def listen(self): """Self-host using 'bind' and 'port' from the WSGI config group."""