Merge "fix(wsgi): a non-existing queue stats returns 404"
This commit is contained in:
commit
34db56a1cc
@ -33,6 +33,10 @@ class QueueLifecycleBaseTest(base.TestBase):
|
||||
path = '/v1/queues/gumshoe'
|
||||
|
||||
for project_id in ('480924', 'foo', '', None):
|
||||
# Stats
|
||||
self.simulate_get(path + '/stats', project_id)
|
||||
self.assertEquals(self.srmock.status, falcon.HTTP_404)
|
||||
|
||||
# Create
|
||||
doc = '{"messages": {"ttl": 600}}'
|
||||
self.simulate_put(path, project_id, body=doc)
|
||||
|
@ -16,7 +16,9 @@
|
||||
import falcon
|
||||
|
||||
import marconi.openstack.common.log as logging
|
||||
from marconi.storage import exceptions as storage_exceptions
|
||||
from marconi.transport import helpers
|
||||
from marconi.transport.wsgi import exceptions as wsgi_exceptions
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -38,8 +40,10 @@ class Resource(object):
|
||||
resp.body = helpers.to_json(resp_dict)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
except storage_exceptions.DoesNotExist:
|
||||
raise falcon.HTTPNotFound()
|
||||
|
||||
except Exception as ex:
|
||||
LOG.exception(ex)
|
||||
title = _('Service temporarily unavailable')
|
||||
msg = _('Please try again in a few seconds.')
|
||||
raise falcon.HTTPServiceUnavailable(title, msg, 30)
|
||||
description = _('Queue stats could not be read.')
|
||||
raise wsgi_exceptions.HTTPServiceUnavailable(description)
|
||||
|
Loading…
x
Reference in New Issue
Block a user