Update the purge exception catch
1.ValueError is an ancestor class of ValidationFailed. It should be removed. 2.Add the unified Exception to avoid 500 internal error. Change-Id: I5f9d6c9dc0939f2397059534560a2752476706cd
This commit is contained in:
parent
c723446e77
commit
07a456acc8
@ -18,6 +18,7 @@ from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from zaqar.common import decorators
|
||||
from zaqar.i18n import _
|
||||
from zaqar.transport import acl
|
||||
from zaqar.transport import validation
|
||||
from zaqar.transport.wsgi import errors as wsgi_errors
|
||||
@ -49,9 +50,6 @@ class Resource(object):
|
||||
self._validate.queue_purging(document)
|
||||
else:
|
||||
document = {'resource_types': ['messages', 'subscriptions']}
|
||||
except ValueError as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
@ -78,5 +76,9 @@ class Resource(object):
|
||||
project=project_id)
|
||||
except ValueError as err:
|
||||
raise wsgi_errors.HTTPBadRequestAPI(str(err))
|
||||
except Exception as ex:
|
||||
LOG.exception(ex)
|
||||
description = _(u'Queue could not be purged.')
|
||||
raise wsgi_errors.HTTPServiceUnavailable(description)
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
Loading…
x
Reference in New Issue
Block a user