Renamed "exceptions" module to "errors"

Changes exceptions.py into error.py

Renaming exception-related code to errors
because most of the conditions handled by
marconi are errorneous rather than exceptional.

Closes-Bug:#1232074

Change-Id: Ie3509236b07a372a44d97f97e5f3fe183b409606
This commit is contained in:
cpallares 2013-10-28 10:49:27 -05:00
parent 4f5de4b23f
commit 5624bf1a14
40 changed files with 183 additions and 182 deletions

View File

@ -19,7 +19,7 @@ import jsonschema
from marconi.openstack.common import log
from marconi.queues.transport import utils as json_utils
from marconi.queues.transport.wsgi import exceptions as wsgi_errors
from marconi.queues.transport.wsgi import errors as wsgi_errors
LOG = log.getLogger(__name__)

View File

@ -19,7 +19,7 @@ from stevedore import driver
from marconi.common import access
from marconi.common.cache import cache as oslo_cache
from marconi.common import decorators
from marconi.common import exceptions
from marconi.common import errors
from marconi.openstack.common import log
from marconi.proxy import transport # NOQA
@ -68,7 +68,7 @@ class Bootstrap(object):
return mgr.driver
except RuntimeError as exc:
LOG.exception(exc)
raise exceptions.InvalidDriver(exc)
raise errors.InvalidDriver(exc)
@decorators.lazy_property(write=False)
def cache(self):
@ -78,7 +78,7 @@ class Bootstrap(object):
return mgr
except RuntimeError as exc:
LOG.exception(exc)
raise exceptions.InvalidDriver(exc)
raise errors.InvalidDriver(exc)
@decorators.lazy_property(write=False)
def transport(self):
@ -92,7 +92,7 @@ class Bootstrap(object):
return mgr.driver
except RuntimeError as exc:
LOG.exception(exc)
raise exceptions.InvalidDriver(exc)
raise errors.InvalidDriver(exc)
def run(self):
self.transport.listen()

View File

@ -1,7 +1,7 @@
"""Marconi proxy storage drivers"""
from marconi.proxy.storage import base
from marconi.proxy.storage import exceptions # NOQA
from marconi.proxy.storage import errors # NOQA
# NOTE(cpp-cabrera): Hoist classes into package namespace
CatalogueBase = base.CatalogueBase

View File

@ -15,7 +15,7 @@
import six
from marconi.proxy.storage import base
from marconi.proxy.storage import exceptions
from marconi.proxy.storage import errors
def _idx(project, queue):
@ -37,7 +37,7 @@ class CatalogueController(base.CatalogueBase):
try:
entry = self._col[_idx(project, queue)]
except KeyError:
raise exceptions.EntryNotFound(project, queue)
raise errors.EntryNotFound(project, queue)
return _normalize(entry)

View File

@ -16,7 +16,7 @@
import six
from marconi.proxy.storage import base
from marconi.proxy.storage import exceptions
from marconi.proxy.storage import errors
class PartitionsController(base.PartitionsBase):
@ -33,7 +33,7 @@ class PartitionsController(base.PartitionsBase):
try:
entry = self._col[name]
except KeyError:
raise exceptions.PartitionNotFound(name)
raise errors.PartitionNotFound(name)
return _normalize(entry)
@ -52,7 +52,7 @@ class PartitionsController(base.PartitionsBase):
try:
self._col[name].update(fields)
except KeyError:
raise exceptions.PartitionNotFound(name)
raise errors.PartitionNotFound(name)
def delete(self, name):
try:

View File

@ -29,7 +29,7 @@ from pymongo import errors
import marconi.openstack.common.log as logging
from marconi.proxy.storage import base
from marconi.proxy.storage import exceptions
from marconi.proxy.storage import errors as storage_errors
from marconi.queues.storage.mongodb import utils
@ -64,7 +64,7 @@ class CatalogueController(base.CatalogueBase):
fields=fields)
if entry is None:
raise exceptions.EntryNotFound(project, queue)
raise storage_errors.EntryNotFound(project, queue)
return _normalize(entry)

View File

@ -25,7 +25,7 @@ Schema:
"""
from marconi.proxy.storage import base
from marconi.proxy.storage import exceptions
from marconi.proxy.storage import errors
from marconi.queues.storage.mongodb import utils
@ -55,7 +55,7 @@ class PartitionsController(base.PartitionsBase):
fields=fields)
if partition is None:
raise exceptions.PartitionNotFound(name)
raise errors.PartitionNotFound(name)
return _normalize(partition)
@ -94,7 +94,7 @@ class PartitionsController(base.PartitionsBase):
{'$set': fields},
upsert=False)
if not res['updatedExisting']:
raise exceptions.PartitionNotFound(name)
raise errors.PartitionNotFound(name)
def _normalize(entry):

View File

@ -21,7 +21,7 @@ import json
import falcon
from marconi.openstack.common import log
from marconi.proxy.storage import exceptions
from marconi.proxy.storage import errors
from marconi.proxy.utils import helpers
@ -66,7 +66,7 @@ class Resource(object):
entry = None
try:
entry = self._catalogue.get(project, queue)
except exceptions.EntryNotFound:
except errors.EntryNotFound:
LOG.debug('Entry not found')
raise falcon.HTTPNotFound()

View File

@ -34,10 +34,10 @@ import six
from marconi.common.transport.wsgi import utils
from marconi.openstack.common import log
from marconi.proxy.storage import exceptions
from marconi.proxy.storage import errors
from marconi.proxy.transport import schema
from marconi.proxy.utils import lookup
from marconi.queues.transport.wsgi import exceptions as wsgi_errors
from marconi.queues.transport.wsgi import errors as wsgi_errors
LOG = log.getLogger(__name__)
@ -96,7 +96,7 @@ class Resource(object):
data = None
try:
data = self._ctrl.get(partition)
except exceptions.PartitionNotFound as ex:
except errors.PartitionNotFound as ex:
LOG.exception(ex)
raise falcon.HTTPNotFound()
@ -163,6 +163,6 @@ class Resource(object):
and v is not None)
self._ctrl.update(partition, **fields)
except exceptions.PartitionNotFound as ex:
except errors.PartitionNotFound as ex:
LOG.exception(ex)
raise falcon.HTTPNotFound()

View File

@ -42,7 +42,7 @@ from marconi.proxy.utils import (
)
from marconi.queues.storage import base as storage
from marconi.queues.transport import validation as validate
from marconi.queues.transport.wsgi import exceptions as wsgi_exceptions
from marconi.queues.transport.wsgi import errors as wsgi_errors
LOG = log.getLogger(__name__)
@ -81,7 +81,7 @@ class Listing(object):
try:
validate.queue_listing(limit=limit)
except validate.ValidationFailed as ex:
raise wsgi_exceptions.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
for queue in self._catalogue.list(project):
queue_name = queue['name']

View File

@ -18,7 +18,7 @@
import msgpack
from marconi.openstack.common import log
from marconi.proxy.storage import exceptions
from marconi.proxy.storage import errors
LOG = log.getLogger(__name__)
@ -56,7 +56,7 @@ def try_cache_entry(project, queue, catalogue_controller, cache):
try:
name = catalogue_controller.get(project, queue)['partition']
except exceptions.EntryNotFound:
except errors.EntryNotFound:
return None
cache.set(key, name)
@ -156,7 +156,7 @@ def hosts(name, partitions_controller, cache):
try:
hosts = partitions_controller.get(name)['hosts']
except exceptions.PartitionNotFound:
except errors.PartitionNotFound:
LOG.debug('Partition not in primary storage: ' + name)
return None

View File

@ -18,7 +18,7 @@ from stevedore import driver
from marconi.common.cache import cache as oslo_cache
from marconi.common import decorators
from marconi.common import exceptions
from marconi.common import errors
from marconi.openstack.common import log
from marconi.queues.storage import pipeline
from marconi.queues.storage import sharding
@ -82,7 +82,7 @@ class Bootstrap(object):
return mgr
except RuntimeError as exc:
LOG.exception(exc)
raise exceptions.InvalidDriver(exc)
raise errors.InvalidDriver(exc)
@decorators.lazy_property(write=False)
def transport(self):
@ -99,7 +99,7 @@ class Bootstrap(object):
return mgr.driver
except RuntimeError as exc:
LOG.exception(exc)
raise exceptions.InvalidDriver(exc)
raise errors.InvalidDriver(exc)
def run(self):
self.transport.listen()

View File

@ -1,7 +1,7 @@
"""Marconi Storage Drivers"""
from marconi.queues.storage import base
from marconi.queues.storage import exceptions # NOQA
from marconi.queues.storage import errors # NOQA
# Hoist classes into package namespace
ControlDriverBase = base.ControlDriverBase

View File

@ -24,7 +24,7 @@ Serves to construct an association between a project + queue -> shard
"""
import marconi.openstack.common.log as logging
from marconi.queues.storage import base, exceptions
from marconi.queues.storage import base, errors
from marconi.queues.storage.mongodb import utils
@ -67,7 +67,7 @@ class CatalogueController(base.CatalogueBase):
fields=fields)
if entry is None:
raise exceptions.QueueNotMapped(project, queue)
raise errors.QueueNotMapped(project, queue)
return _normalize(entry)
@ -90,7 +90,7 @@ class CatalogueController(base.CatalogueBase):
res = self._insert(project, queue, shard, upsert=False)
if not res['updatedExisting']:
raise exceptions.QueueNotMapped(project, queue)
raise errors.QueueNotMapped(project, queue)
@utils.raises_conn_error
def drop_all(self):

View File

@ -28,7 +28,7 @@ from bson import objectid
import marconi.openstack.common.log as logging
from marconi.openstack.common import timeutils
from marconi.queues import storage
from marconi.queues.storage import exceptions
from marconi.queues.storage import errors
from marconi.queues.storage.mongodb import utils
@ -64,7 +64,7 @@ class ClaimController(storage.ClaimBase):
now = timeutils.utcnow_ts()
cid = utils.to_oid(claim_id)
if cid is None:
raise exceptions.ClaimDoesNotExist(queue, project, claim_id)
raise errors.ClaimDoesNotExist(queue, project, claim_id)
def messages(msg_iter):
msg = next(msg_iter)
@ -93,7 +93,7 @@ class ClaimController(storage.ClaimBase):
'id': str(claim['id']),
}
except StopIteration:
raise exceptions.ClaimDoesNotExist(cid, queue, project)
raise errors.ClaimDoesNotExist(cid, queue, project)
return (claim_meta, msgs)
@ -195,7 +195,7 @@ class ClaimController(storage.ClaimBase):
def update(self, queue, claim_id, metadata, project=None):
cid = utils.to_oid(claim_id)
if cid is None:
raise exceptions.ClaimDoesNotExist(claim_id, queue, project)
raise errors.ClaimDoesNotExist(claim_id, queue, project)
now = timeutils.utcnow_ts()
ttl = int(metadata.get('ttl', 60))
@ -208,7 +208,7 @@ class ClaimController(storage.ClaimBase):
try:
next(claimed)
except StopIteration:
raise exceptions.ClaimDoesNotExist(claim_id, queue, project)
raise errors.ClaimDoesNotExist(claim_id, queue, project)
meta = {
'id': cid,

View File

@ -30,7 +30,7 @@ import pymongo.read_preferences
import marconi.openstack.common.log as logging
from marconi.openstack.common import timeutils
from marconi.queues import storage
from marconi.queues.storage import exceptions
from marconi.queues.storage import errors
from marconi.queues.storage.mongodb import utils
@ -391,7 +391,7 @@ class MessageController(storage.MessageBase):
try:
message = next(cursor)
except StopIteration:
raise exceptions.QueueIsEmpty(queue_name, project)
raise errors.QueueIsEmpty(queue_name, project)
return message
@ -399,8 +399,8 @@ class MessageController(storage.MessageBase):
def get(self, queue_name, message_id, project=None):
mid = utils.to_oid(message_id)
if mid is None:
raise exceptions.MessageDoesNotExist(message_id, queue_name,
project)
raise errors.MessageDoesNotExist(message_id, queue_name,
project)
now = timeutils.utcnow_ts()
@ -413,8 +413,8 @@ class MessageController(storage.MessageBase):
message = list(collection.find(query).limit(1).hint(ID_INDEX_FIELDS))
if not message:
raise exceptions.MessageDoesNotExist(message_id, queue_name,
project)
raise errors.MessageDoesNotExist(message_id, queue_name,
project)
return _basic_message(message[0], now)
@ -446,7 +446,7 @@ class MessageController(storage.MessageBase):
@utils.raises_conn_error
def post(self, queue_name, messages, client_uuid, project=None):
if not self._queue_ctrl.exists(queue_name, project):
raise exceptions.QueueDoesNotExist(queue_name, project)
raise errors.QueueDoesNotExist(queue_name, project)
now = timeutils.utcnow_ts()
now_dt = datetime.datetime.utcfromtimestamp(now)
@ -606,7 +606,8 @@ class MessageController(storage.MessageBase):
project=project))
succeeded_ids = []
raise exceptions.MessageConflict(queue_name, project, succeeded_ids)
raise errors.MessageConflict(queue_name, project,
succeeded_ids)
@utils.raises_conn_error
def delete(self, queue_name, message_id, project=None, claim=None):
@ -641,11 +642,11 @@ class MessageController(storage.MessageBase):
if claim is None:
if is_claimed:
raise exceptions.MessageIsClaimed(message_id)
raise errors.MessageIsClaimed(message_id)
else:
if message['c']['id'] != cid:
raise exceptions.MessageIsClaimedBy(message_id, claim)
raise errors.MessageIsClaimedBy(message_id, claim)
collection.remove(query['_id'], w=0)

View File

@ -26,7 +26,7 @@ import pymongo.errors
import marconi.openstack.common.log as logging
from marconi.openstack.common import timeutils
from marconi.queues import storage
from marconi.queues.storage import exceptions
from marconi.queues.storage import errors
from marconi.queues.storage.mongodb import utils
@ -75,7 +75,7 @@ class QueueController(storage.QueueBase):
queue = self._collection.find_one(_get_scoped_query(name, project),
fields=fields)
if queue is None:
raise exceptions.QueueDoesNotExist(name, project)
raise errors.QueueDoesNotExist(name, project)
return queue
@ -105,7 +105,7 @@ class QueueController(storage.QueueBase):
fields={'c.v': 1, '_id': 0})
if doc is None:
raise exceptions.QueueDoesNotExist(name, project)
raise errors.QueueDoesNotExist(name, project)
return doc['c']['v']
@ -123,7 +123,7 @@ class QueueController(storage.QueueBase):
was specified, and the counter has already been updated
within the specified time period.
:raises: storage.exceptions.QueueDoesNotExist
:raises: storage.errors.QueueDoesNotExist
"""
now = timeutils.utcnow_ts()
@ -147,13 +147,14 @@ class QueueController(storage.QueueBase):
# NOTE(kgriffs): Since we did not filter by a time window,
# the queue should have been found and updated. Perhaps
# the queue has been deleted?
msgtmpl = _(u'Failed to increment the message '
message = _(u'Failed to increment the message '
u'counter for queue %(name)s and '
u'project %(project)s')
message %= dict(name=name, project=project)
LOG.warning(msgtmpl, dict(name=name, project=project))
LOG.warning(message)
raise exceptions.QueueDoesNotExist(name, project)
raise errors.QueueDoesNotExist(name, project)
# NOTE(kgriffs): Assume the queue existed, but the counter
# was recently updated, causing the range query on 'c.t' to
@ -227,7 +228,7 @@ class QueueController(storage.QueueBase):
manipulate=False)
if not rst['updatedExisting']:
raise exceptions.QueueDoesNotExist(name, project)
raise errors.QueueDoesNotExist(name, project)
@utils.raises_conn_error
def delete(self, name, project=None):
@ -237,7 +238,7 @@ class QueueController(storage.QueueBase):
@utils.raises_conn_error
def stats(self, name, project=None):
if not self.exists(name, project=project):
raise exceptions.QueueDoesNotExist(name, project)
raise errors.QueueDoesNotExist(name, project)
controller = self.driver.message_controller
@ -255,7 +256,7 @@ class QueueController(storage.QueueBase):
try:
oldest = controller.first(name, project=project, sort=1)
newest = controller.first(name, project=project, sort=-1)
except exceptions.QueueIsEmpty:
except errors.QueueIsEmpty:
pass
else:
now = timeutils.utcnow_ts()

View File

@ -25,7 +25,7 @@ Schema:
"""
from marconi.common import utils as common_utils
from marconi.queues.storage import base, exceptions
from marconi.queues.storage import base, errors
from marconi.queues.storage.mongodb import utils
SHARDS_INDEX = [
@ -66,7 +66,7 @@ class ShardsController(base.ShardsBase):
res = self._col.find_one({'n': name},
_field_spec(detailed))
if not res:
raise exceptions.ShardDoesNotExist(name)
raise errors.ShardDoesNotExist(name)
return res
@utils.raises_conn_error
@ -92,7 +92,7 @@ class ShardsController(base.ShardsBase):
{'$set': fields},
upsert=False)
if not res['updatedExisting']:
raise exceptions.ShardDoesNotExist(name)
raise errors.ShardDoesNotExist(name)
@utils.raises_conn_error
def delete(self, name):

View File

@ -26,7 +26,7 @@ from pymongo import errors
import marconi.openstack.common.log as logging
from marconi.openstack.common import timeutils
from marconi.queues.storage import exceptions as storage_exceptions
from marconi.queues.storage import errors as storage_errors
# BSON ObjectId gives TZ-aware datetime, so we generate a
@ -241,7 +241,7 @@ def raises_conn_error(func):
"""Handles mongodb ConnectionFailure error
This decorator catches mongodb's ConnectionFailure
exceptions and raises Marconi's ConnectionError instead.
error and raises Marconi's ConnectionError instead.
"""
@functools.wraps(func)
@ -252,7 +252,7 @@ def raises_conn_error(func):
# NOTE(flaper87): Raise the error
LOG.exception(ex)
msg = u'ConnectionFailure caught'
raise storage_exceptions.ConnectionError(msg)
raise storage_errors.ConnectionError(msg)
return wrapper

View File

@ -14,7 +14,7 @@
# limitations under the License.
from marconi.queues.storage import base
from marconi.queues.storage import exceptions
from marconi.queues.storage import errors
from marconi.queues.storage.sqlite import utils
@ -26,7 +26,7 @@ class ClaimController(base.ClaimBase):
cid = utils.cid_decode(claim_id)
if cid is None:
raise exceptions.ClaimDoesNotExist(claim_id, queue, project)
raise errors.ClaimDoesNotExist(claim_id, queue, project)
with self.driver('deferred'):
try:
@ -48,7 +48,7 @@ class ClaimController(base.ClaimBase):
)
except utils.NoResult:
raise exceptions.ClaimDoesNotExist(claim_id, queue, project)
raise errors.ClaimDoesNotExist(claim_id, queue, project)
def create(self, queue, metadata, project, limit=None):
@ -61,7 +61,7 @@ class ClaimController(base.ClaimBase):
with self.driver('immediate'):
try:
qid = utils.get_qid(self.driver, queue, project)
except exceptions.QueueDoesNotExist:
except errors.QueueDoesNotExist:
return None, iter([])
# Clean up all expired claims in this queue
@ -115,7 +115,7 @@ class ClaimController(base.ClaimBase):
id = utils.cid_decode(claim_id)
if id is None:
raise exceptions.ClaimDoesNotExist(claim_id, queue, project)
raise errors.ClaimDoesNotExist(claim_id, queue, project)
with self.driver('deferred'):
@ -131,9 +131,7 @@ class ClaimController(base.ClaimBase):
''', metadata['ttl'], id, project, queue)
if not self.driver.affected:
raise exceptions.ClaimDoesNotExist(claim_id,
queue,
project)
raise errors.ClaimDoesNotExist(claim_id, queue, project)
self.__update_claimed(id, metadata['ttl'])

View File

@ -15,7 +15,7 @@
from marconi.openstack.common import timeutils
from marconi.queues.storage import base
from marconi.queues.storage import exceptions
from marconi.queues.storage import errors
from marconi.queues.storage.sqlite import utils
@ -27,7 +27,7 @@ class MessageController(base.MessageBase):
mid = utils.msgid_decode(message_id)
if mid is None:
raise exceptions.MessageDoesNotExist(message_id, queue, project)
raise errors.MessageDoesNotExist(message_id, queue, project)
try:
content, ttl, age = self.driver.get('''
@ -39,7 +39,7 @@ class MessageController(base.MessageBase):
''', mid, project, queue)
except utils.NoResult:
raise exceptions.MessageDoesNotExist(message_id, queue, project)
raise errors.MessageDoesNotExist(message_id, queue, project)
return {
'id': message_id,
@ -101,7 +101,7 @@ class MessageController(base.MessageBase):
try:
id, content, ttl, created, age = next(records)
except StopIteration:
raise exceptions.QueueIsEmpty(queue, project)
raise errors.QueueIsEmpty(queue, project)
created_unix = utils.julian_to_unix(created)
created_iso8601 = timeutils.iso8601_from_timestamp(created_unix)
@ -239,7 +239,7 @@ class MessageController(base.MessageBase):
''', id)
if not self.driver.affected:
raise exceptions.MessageIsClaimed(id)
raise errors.MessageIsClaimed(id)
def __delete_claimed(self, id, claim):
# Precondition: id exists in a specific queue
@ -258,7 +258,7 @@ class MessageController(base.MessageBase):
''', id, cid)
if not self.driver.affected:
raise exceptions.MessageIsClaimedBy(id, claim)
raise errors.MessageIsClaimedBy(id, claim)
def bulk_delete(self, queue, message_ids, project):
if project is None:

View File

@ -15,7 +15,7 @@
# limitations under the License.
from marconi.queues.storage import base
from marconi.queues.storage import exceptions
from marconi.queues.storage import errors
from marconi.queues.storage.sqlite import utils
@ -71,7 +71,7 @@ class QueueController(base.QueueBase):
where project = ? and name = ?''', project, name)[0]
except utils.NoResult:
raise exceptions.QueueDoesNotExist(name, project)
raise errors.QueueDoesNotExist(name, project)
def create(self, name, project):
if project is None:
@ -105,7 +105,7 @@ class QueueController(base.QueueBase):
''', self.driver.pack(metadata), project, name)
if not self.driver.affected:
raise exceptions.QueueDoesNotExist(name, project)
raise errors.QueueDoesNotExist(name, project)
def delete(self, name, project):
if project is None:
@ -148,7 +148,7 @@ class QueueController(base.QueueBase):
message_controller = self.driver.message_controller
oldest = message_controller.first(name, project, sort=1)
newest = message_controller.first(name, project, sort=-1)
except exceptions.QueueIsEmpty:
except errors.QueueIsEmpty:
pass
else:
message_stats['oldest'] = utils.stat_message(oldest)

View File

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from marconi.queues.storage import exceptions
from marconi.queues.storage import errors
UNIX_EPOCH_AS_JULIAN_SEC = 2440587.5 * 86400.0
@ -31,7 +31,7 @@ def get_qid(driver, queue, project):
where project = ? and name = ?''', project, queue)[0]
except NoResult:
raise exceptions.QueueDoesNotExist(queue, project)
raise errors.QueueDoesNotExist(queue, project)
# The utilities below make the database IDs opaque to the users

View File

@ -16,7 +16,7 @@
from stevedore import driver
from marconi.common import exceptions
from marconi.common import errors
from marconi.openstack.common import log
LOG = log.getLogger(__name__)
@ -40,4 +40,4 @@ def load_storage_driver(conf):
except RuntimeError as exc:
LOG.exception(exc)
raise exceptions.InvalidDriver(exc)
raise errors.InvalidDriver(exc)

View File

@ -17,10 +17,10 @@ import falcon
import six
import marconi.openstack.common.log as logging
from marconi.queues.storage import exceptions as storage_exceptions
from marconi.queues.storage import errors as storage_errors
from marconi.queues.transport import utils
from marconi.queues.transport import validation
from marconi.queues.transport.wsgi import exceptions as wsgi_exceptions
from marconi.queues.transport.wsgi import errors as wsgi_errors
from marconi.queues.transport.wsgi import utils as wsgi_utils
LOG = logging.getLogger(__name__)
@ -53,7 +53,7 @@ class CollectionResource(Resource):
# Place JSON size restriction before parsing
if req.content_length > self._metadata_max_length:
description = _(u'Claim metadata size is too large.')
raise wsgi_exceptions.HTTPBadRequestBody(description)
raise wsgi_errors.HTTPBadRequestBody(description)
# Read claim metadata (e.g., TTL) and raise appropriate
# HTTP errors as needed.
@ -74,12 +74,12 @@ class CollectionResource(Resource):
resp_msgs = list(msgs)
except validation.ValidationFailed as ex:
raise wsgi_exceptions.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
except Exception as ex:
LOG.exception(ex)
description = _(u'Claim could not be created.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
# Serialize claimed messages, if any. This logic assumes
# the storage driver returned well-formed messages.
@ -122,12 +122,12 @@ class ItemResource(Resource):
# TODO(kgriffs): Optimize along with serialization (see below)
meta['messages'] = list(msgs)
except storage_exceptions.DoesNotExist:
except storage_errors.DoesNotExist:
raise falcon.HTTPNotFound()
except Exception as ex:
LOG.exception(ex)
description = _(u'Claim could not be queried.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
# Serialize claimed messages
# TODO(kgriffs): Optimize
@ -153,7 +153,7 @@ class ItemResource(Resource):
# Place JSON size restriction before parsing
if req.content_length > self._metadata_max_length:
description = _(u'Claim metadata size is too large.')
raise wsgi_exceptions.HTTPBadRequestBody(description)
raise wsgi_errors.HTTPBadRequestBody(description)
# Read claim metadata (e.g., TTL) and raise appropriate
# HTTP errors as needed.
@ -170,15 +170,15 @@ class ItemResource(Resource):
resp.status = falcon.HTTP_204
except validation.ValidationFailed as ex:
raise wsgi_exceptions.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
except storage_exceptions.DoesNotExist:
except storage_errors.DoesNotExist:
raise falcon.HTTPNotFound()
except Exception as ex:
LOG.exception(ex)
description = _(u'Claim could not be updated.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
def on_delete(self, req, resp, project_id, queue_name, claim_id):
LOG.debug(_(u'Claim item DELETE - claim: %(claim_id)s, '
@ -196,7 +196,7 @@ class ItemResource(Resource):
except Exception as ex:
LOG.exception(ex)
description = _(u'Claim could not be deleted.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
# TODO(kgriffs): Clean up/optimize and move to wsgi.utils

View File

@ -17,10 +17,10 @@ import falcon
import six
import marconi.openstack.common.log as logging
from marconi.queues.storage import exceptions as storage_exceptions
from marconi.queues.storage import errors as storage_errors
from marconi.queues.transport import utils
from marconi.queues.transport import validation
from marconi.queues.transport.wsgi import exceptions as wsgi_exceptions
from marconi.queues.transport.wsgi import errors as wsgi_errors
from marconi.queues.transport.wsgi import utils as wsgi_utils
LOG = logging.getLogger(__name__)
@ -51,12 +51,12 @@ class CollectionResource(object):
project=project_id)
except validation.ValidationFailed as ex:
raise wsgi_exceptions.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
except Exception as ex:
LOG.exception(ex)
description = _(u'Message could not be retrieved.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
# Prepare response
messages = list(messages)
@ -94,15 +94,15 @@ class CollectionResource(object):
messages = list(cursor)
except validation.ValidationFailed as ex:
raise wsgi_exceptions.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
except storage_exceptions.DoesNotExist:
except storage_errors.DoesNotExist:
raise falcon.HTTPNotFound()
except Exception as ex:
LOG.exception(ex)
description = _(u'Messages could not be listed.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
if not messages:
return None
@ -137,7 +137,7 @@ class CollectionResource(object):
# Place JSON size restriction before parsing
if req.content_length > self._wsgi_conf.content_max_length:
description = _(u'Message collection size is too large.')
raise wsgi_exceptions.HTTPBadRequestBody(description)
raise wsgi_errors.HTTPBadRequestBody(description)
# Pull out just the fields we care about
messages = wsgi_utils.filter_stream(
@ -164,12 +164,12 @@ class CollectionResource(object):
client_uuid=client_uuid)
except validation.ValidationFailed as ex:
raise wsgi_exceptions.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
except storage_exceptions.DoesNotExist:
except storage_errors.DoesNotExist:
raise falcon.HTTPNotFound()
except storage_exceptions.MessageConflict as ex:
except storage_errors.MessageConflict as ex:
LOG.exception(ex)
partial = True
message_ids = ex.succeeded_ids
@ -178,12 +178,12 @@ class CollectionResource(object):
# TODO(kgriffs): Include error code that is different
# from the code used in the generic case, below.
description = _(u'No messages could be enqueued.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
except Exception as ex:
LOG.exception(ex)
description = _(u'Messages could not be enqueued.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
# Prepare the response
ids_value = ','.join(message_ids)
@ -228,12 +228,12 @@ class CollectionResource(object):
project=project_id)
except validation.ValidationFailed as ex:
raise wsgi_exceptions.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
except Exception as ex:
LOG.exception(ex)
description = _(u'Messages could not be deleted.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
resp.status = falcon.HTTP_204
@ -257,13 +257,13 @@ class ItemResource(object):
message_id,
project=project_id)
except storage_exceptions.DoesNotExist:
except storage_errors.DoesNotExist:
raise falcon.HTTPNotFound()
except Exception as ex:
LOG.exception(ex)
description = _(u'Message could not be retrieved.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
# Prepare response
message['href'] = req.path
@ -286,7 +286,7 @@ class ItemResource(object):
project=project_id,
claim=req.get_param('claim_id'))
except storage_exceptions.NotPermitted as ex:
except storage_errors.NotPermitted as ex:
LOG.exception(ex)
title = _(u'Unable to delete')
description = _(u'This message is claimed; it cannot be '
@ -296,7 +296,7 @@ class ItemResource(object):
except Exception as ex:
LOG.exception(ex)
description = _(u'Message could not be deleted.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
# Alles guete
resp.status = falcon.HTTP_204

View File

@ -17,10 +17,10 @@ import falcon
import six
import marconi.openstack.common.log as logging
from marconi.queues.storage import exceptions as storage_exceptions
from marconi.queues.storage import errors as storage_errors
from marconi.queues.transport import utils
from marconi.queues.transport import validation
from marconi.queues.transport.wsgi import exceptions as wsgi_exceptions
from marconi.queues.transport.wsgi import errors as wsgi_errors
from marconi.queues.transport.wsgi import utils as wsgi_utils
@ -44,13 +44,13 @@ class Resource(object):
resp_dict = self.queue_ctrl.get_metadata(queue_name,
project=project_id)
except storage_exceptions.DoesNotExist:
except storage_errors.DoesNotExist:
raise falcon.HTTPNotFound()
except Exception as ex:
LOG.exception(ex)
description = _(u'Queue metadata could not be retrieved.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
resp.content_location = req.path
resp.body = utils.to_json(resp_dict)
@ -64,7 +64,7 @@ class Resource(object):
# Place JSON size restriction before parsing
if req.content_length > self._wsgi_conf.metadata_max_length:
description = _(u'Queue metadata size is too large.')
raise wsgi_exceptions.HTTPBadRequestBody(description)
raise wsgi_errors.HTTPBadRequestBody(description)
# Deserialize queue metadata
metadata, = wsgi_utils.filter_stream(req.stream,
@ -81,15 +81,15 @@ class Resource(object):
project=project_id)
except validation.ValidationFailed as ex:
raise wsgi_exceptions.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
except storage_exceptions.QueueDoesNotExist:
except storage_errors.QueueDoesNotExist:
raise falcon.HTTPNotFound()
except Exception as ex:
LOG.exception(ex)
description = _(u'Metadata could not be updated.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
resp.status = falcon.HTTP_204
resp.location = req.path

View File

@ -19,7 +19,7 @@ import six
import marconi.openstack.common.log as logging
from marconi.queues.transport import utils
from marconi.queues.transport import validation
from marconi.queues.transport.wsgi import exceptions as wsgi_exceptions
from marconi.queues.transport.wsgi import errors as wsgi_errors
LOG = logging.getLogger(__name__)
@ -45,7 +45,7 @@ class ItemResource(object):
except Exception as ex:
LOG.exception(ex)
description = _(u'Queue could not be created.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
resp.status = falcon.HTTP_201 if created else falcon.HTTP_204
resp.location = req.path
@ -74,7 +74,7 @@ class ItemResource(object):
except Exception as ex:
LOG.exception(ex)
description = _(u'Queue could not be deleted.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
resp.status = falcon.HTTP_204
@ -102,12 +102,12 @@ class CollectionResource(object):
results = self.queue_controller.list(project=project_id, **kwargs)
except validation.ValidationFailed as ex:
raise wsgi_exceptions.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
except Exception as ex:
LOG.exception(ex)
description = _(u'Queues could not be listed.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)
# Buffer list of queues
queues = list(next(results))

View File

@ -39,9 +39,9 @@ import jsonschema
from marconi.common.schemas import shards as schema
from marconi.common.transport.wsgi import utils
from marconi.openstack.common import log
from marconi.proxy.storage import exceptions
from marconi.proxy.storage import errors
from marconi.queues.transport import utils as transport_utils
from marconi.queues.transport.wsgi import exceptions as wsgi_errors
from marconi.queues.transport.wsgi import errors as wsgi_errors
LOG = log.getLogger(__name__)
@ -101,7 +101,7 @@ class Resource(object):
data = None
try:
data = self._ctrl.get(shard)
except exceptions.ShardDoesNotExist as ex:
except errors.ShardDoesNotExist as ex:
LOG.exception(ex)
raise falcon.HTTPNotFound()
@ -173,6 +173,6 @@ class Resource(object):
if k in EXPECT and v is not None)
self._ctrl.update(shard, **fields)
except exceptions.ShardDoesNotExist as ex:
except errors.ShardDoesNotExist as ex:
LOG.exception(ex)
raise falcon.HTTPNotFound()

View File

@ -16,9 +16,9 @@
import falcon
import marconi.openstack.common.log as logging
from marconi.queues.storage import exceptions as storage_exceptions
from marconi.queues.storage import errors as storage_errors
from marconi.queues.transport import utils
from marconi.queues.transport.wsgi import exceptions as wsgi_exceptions
from marconi.queues.transport.wsgi import errors as wsgi_errors
LOG = logging.getLogger(__name__)
@ -53,10 +53,10 @@ class Resource(object):
resp.body = utils.to_json(resp_dict)
# status defaults to 200
except storage_exceptions.DoesNotExist:
except storage_errors.DoesNotExist:
raise falcon.HTTPNotFound()
except Exception as ex:
LOG.exception(ex)
description = _(u'Queue stats could not be read.')
raise wsgi_exceptions.HTTPServiceUnavailable(description)
raise wsgi_errors.HTTPServiceUnavailable(description)

View File

@ -18,7 +18,7 @@ import uuid
import marconi.openstack.common.log as logging
from marconi.queues.transport import utils
from marconi.queues.transport.wsgi import exceptions
from marconi.queues.transport.wsgi import errors
JSONObject = dict
@ -58,7 +58,7 @@ def filter_stream(stream, len, spec=None, doctype=JSONObject):
if len is None:
description = _(u'Request body can not be empty')
raise exceptions.HTTPBadRequestBody(description)
raise errors.HTTPBadRequestBody(description)
try:
# TODO(kgriffs): read_json should stream the resulting list
@ -69,28 +69,28 @@ def filter_stream(stream, len, spec=None, doctype=JSONObject):
except utils.MalformedJSON as ex:
LOG.exception(ex)
description = _(u'Request body could not be parsed.')
raise exceptions.HTTPBadRequestBody(description)
raise errors.HTTPBadRequestBody(description)
except utils.OverflowedJSONInteger as ex:
LOG.exception(ex)
description = _(u'JSON contains integer that is too large.')
raise exceptions.HTTPBadRequestBody(description)
raise errors.HTTPBadRequestBody(description)
except Exception as ex:
# Error while reading from the network/server
LOG.exception(ex)
description = _(u'Request body could not be read.')
raise exceptions.HTTPServiceUnavailable(description)
raise errors.HTTPServiceUnavailable(description)
if doctype is JSONObject:
if not isinstance(document, JSONObject):
raise exceptions.HTTPDocumentTypeNotSupported()
raise errors.HTTPDocumentTypeNotSupported()
return (document,) if spec is None else (filter(document, spec),)
if doctype is JSONArray:
if not isinstance(document, JSONArray):
raise exceptions.HTTPDocumentTypeNotSupported()
raise errors.HTTPDocumentTypeNotSupported()
if spec is None:
return document
@ -146,14 +146,14 @@ def get_checked_field(document, name, value_type):
value = document[name]
except KeyError:
description = _(u'Missing "{name}" field.').format(name=name)
raise exceptions.HTTPBadRequestBody(description)
raise errors.HTTPBadRequestBody(description)
if value_type == '*' or isinstance(value, value_type):
return value
description = _(u'The value of the "{name}" field must be a {vtype}.')
description = description.format(name=name, vtype=value_type.__name__)
raise exceptions.HTTPBadRequestBody(description)
raise errors.HTTPBadRequestBody(description)
def get_client_uuid(req):
@ -170,4 +170,4 @@ def get_client_uuid(req):
except ValueError:
description = _(u'Malformed hexadecimal UUID.')
raise exceptions.HTTPBadRequestAPI(description)
raise errors.HTTPBadRequestAPI(description)

View File

@ -24,7 +24,7 @@ from testtools import matchers
from marconi.openstack.common import timeutils
from marconi.queues import storage
from marconi.queues.storage import exceptions
from marconi.queues.storage import errors
from marconi import tests as testing
from marconi.tests import helpers
@ -179,10 +179,10 @@ class QueueControllerTest(ControllerBaseTest):
self.assertFalse(self.controller.exists('test', project=self.project))
# Test DoesNotExist exception
with testing.expect(storage.exceptions.DoesNotExist):
with testing.expect(storage.errors.DoesNotExist):
self.controller.get_metadata('test', project=self.project)
with testing.expect(storage.exceptions.DoesNotExist):
with testing.expect(storage.errors.DoesNotExist):
self.controller.set_metadata('test', '{}', project=self.project)
def test_stats_for_empty_queue(self):
@ -251,7 +251,7 @@ class MessageControllerTest(ControllerBaseTest):
self.controller.delete(queue_name, created[0], project=self.project)
# Test does not exist
with testing.expect(storage.exceptions.DoesNotExist):
with testing.expect(storage.errors.DoesNotExist):
self.controller.get(queue_name, created[0], project=self.project)
def test_get_multi(self):
@ -343,7 +343,7 @@ class MessageControllerTest(ControllerBaseTest):
[msg1, msg2] = msgs
# A wrong claim does not ensure the message deletion
with testing.expect(storage.exceptions.NotPermitted):
with testing.expect(storage.errors.NotPermitted):
self.controller.delete(self.queue_name, msg1['id'],
project=self.project,
claim=another_cid)
@ -353,7 +353,7 @@ class MessageControllerTest(ControllerBaseTest):
project=self.project,
claim=cid)
with testing.expect(storage.exceptions.DoesNotExist):
with testing.expect(storage.errors.DoesNotExist):
self.controller.get(self.queue_name, msg1['id'],
project=self.project)
@ -366,7 +366,7 @@ class MessageControllerTest(ControllerBaseTest):
self.claim_controller.delete(self.queue_name, cid,
project=self.project)
with testing.expect(storage.exceptions.NotPermitted):
with testing.expect(storage.errors.NotPermitted):
self.controller.delete(self.queue_name, msg2['id'],
project=self.project,
claim=cid)
@ -386,7 +386,7 @@ class MessageControllerTest(ControllerBaseTest):
time.sleep(self.gc_interval)
with testing.expect(storage.exceptions.DoesNotExist):
with testing.expect(storage.errors.DoesNotExist):
self.controller.get(self.queue_name, msgid,
project=self.project)
@ -406,7 +406,7 @@ class MessageControllerTest(ControllerBaseTest):
bad_message_id,
project=self.project)
with testing.expect(exceptions.MessageDoesNotExist):
with testing.expect(errors.MessageDoesNotExist):
self.controller.get(self.queue_name,
bad_message_id,
project=self.project)
@ -511,7 +511,7 @@ class ClaimControllerTest(ControllerBaseTest):
self.controller.delete(self.queue_name, claim_id,
project=self.project)
self.assertRaises(storage.exceptions.ClaimDoesNotExist,
self.assertRaises(storage.errors.ClaimDoesNotExist,
self.controller.get, self.queue_name,
claim_id, project=self.project)
@ -576,11 +576,11 @@ class ClaimControllerTest(ControllerBaseTest):
claim_id, messages = self.controller.create(self.queue_name, meta,
project=self.project)
with testing.expect(storage.exceptions.DoesNotExist):
with testing.expect(storage.errors.DoesNotExist):
self.controller.get(self.queue_name, claim_id,
project=self.project)
with testing.expect(storage.exceptions.DoesNotExist):
with testing.expect(storage.errors.DoesNotExist):
self.controller.update(self.queue_name, claim_id,
meta, project=self.project)
@ -591,12 +591,12 @@ class ClaimControllerTest(ControllerBaseTest):
'illformed',
project=self.project)
with testing.expect(exceptions.DoesNotExist):
with testing.expect(errors.DoesNotExist):
self.controller.get(self.queue_name,
'illformed',
project=self.project)
with testing.expect(exceptions.DoesNotExist):
with testing.expect(errors.DoesNotExist):
self.controller.update(self.queue_name,
'illformed',
{'ttl': 40},
@ -657,7 +657,7 @@ class ShardsControllerTest(ControllerBaseTest):
self.assertEqual(res['o'], {})
def test_get_raises_if_not_found(self):
self.assertRaises(storage.exceptions.ShardDoesNotExist,
self.assertRaises(storage.errors.ShardDoesNotExist,
self.shards_controller.get, 'notexists')
def test_exists(self):
@ -781,7 +781,7 @@ class CatalogueControllerTest(ControllerBaseTest):
self._check_value(entry, xqueue=q, xproject=p, xshard=u'b')
def test_update_raises_when_entry_does_not_exist(self):
self.assertRaises(exceptions.QueueNotMapped,
self.assertRaises(errors.QueueNotMapped,
self.controller.update,
'not', 'not', 'a')
@ -798,13 +798,13 @@ class CatalogueControllerTest(ControllerBaseTest):
self.project,
self.queue, u'a') as expect:
p, q, _ = expect
self.assertRaises(exceptions.QueueNotMapped,
self.assertRaises(errors.QueueNotMapped,
self.controller.get,
p, 'non_existing')
self.assertRaises(exceptions.QueueNotMapped,
self.assertRaises(errors.QueueNotMapped,
self.controller.get,
'non_existing', q)
self.assertRaises(exceptions.QueueNotMapped,
self.assertRaises(errors.QueueNotMapped,
self.controller.get,
'non_existing', 'non_existing')

View File

@ -18,7 +18,7 @@ import uuid
import six
from marconi.proxy import storage
from marconi.proxy.storage import exceptions
from marconi.proxy.storage import errors
from marconi import tests as testing
from marconi.tests import helpers
@ -110,7 +110,7 @@ class PartitionsControllerTest(ControllerBaseTest):
'a', cat='adorable')
def test_update_on_nonexisting_raises(self):
self.assertRaises(exceptions.PartitionNotFound,
self.assertRaises(errors.PartitionNotFound,
self.controller.update,
'a', weight=10)
@ -130,7 +130,7 @@ class PartitionsControllerTest(ControllerBaseTest):
self._check_values(p, xname=n, xweight=w, xhosts=h)
def test_get_nonexistent_throws(self):
self.assertRaises(exceptions.PartitionNotFound,
self.assertRaises(errors.PartitionNotFound,
self.controller.get, ('not_found'))
def test_exists(self):

View File

@ -22,7 +22,7 @@ from testtools import matchers
from marconi.openstack.common import timeutils
from marconi.queues import storage
from marconi.queues.storage import exceptions
from marconi.queues.storage import errors
from marconi.queues.storage import mongodb
from marconi.queues.storage.mongodb import controllers
from marconi.queues.storage.mongodb import utils
@ -129,7 +129,8 @@ class MongodbQueueTests(base.QueueControllerTest):
method.side_effect = error
queues = next(self.controller.list())
self.assertRaises(storage.exceptions.ConnectionError, queues.next)
self.assertRaises(storage.errors.ConnectionError,
queues.next)
@testing.requires_mongodb
@ -257,7 +258,7 @@ class MongodbMessageTests(base.MessageControllerTest):
if testing.RUN_SLOW_TESTS:
method.return_value = None
with testing.expect(exceptions.MessageConflict):
with testing.expect(errors.MessageConflict):
self.controller.post(queue_name, messages, uuid)
created = list(self.controller.post(queue_name,
@ -281,7 +282,7 @@ class MongodbMessageTests(base.MessageControllerTest):
queue_name = 'empty-queue-test'
self.queue_controller.create(queue_name)
self.assertRaises(storage.exceptions.QueueIsEmpty,
self.assertRaises(storage.errors.QueueIsEmpty,
self.controller.first, queue_name)
def test_invalid_sort_option(self):
@ -315,7 +316,7 @@ class MongodbClaimTests(base.ClaimControllerTest):
exists and/or has expired.
"""
epoch = '000000000000000000000000'
self.assertRaises(storage.exceptions.ClaimDoesNotExist,
self.assertRaises(storage.errors.ClaimDoesNotExist,
self.controller.get, self.queue_name,
epoch, project=self.project)
@ -325,11 +326,11 @@ class MongodbClaimTests(base.ClaimControllerTest):
# Lets let it expire
time.sleep(1)
self.assertRaises(storage.exceptions.ClaimDoesNotExist,
self.assertRaises(storage.errors.ClaimDoesNotExist,
self.controller.update, self.queue_name,
claim_id, {}, project=self.project)
self.assertRaises(storage.exceptions.ClaimDoesNotExist,
self.assertRaises(storage.errors.ClaimDoesNotExist,
self.controller.update, self.queue_name,
claim_id, {}, project=self.project)

View File

@ -32,7 +32,7 @@ class SQliteMessageTests(base.MessageControllerTest):
queue_name = 'empty-queue-test'
self.queue_controller.create(queue_name, None)
self.assertRaises(storage.exceptions.QueueIsEmpty,
self.assertRaises(storage.errors.QueueIsEmpty,
self.controller.first,
queue_name, None, sort=1)

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from marconi.common import exceptions
from marconi.common import errors
from marconi.queues import bootstrap
from marconi.queues.storage import pipeline
from marconi.queues.storage import sharding
@ -30,7 +30,7 @@ class TestBootstrap(base.TestBase):
def test_storage_invalid(self):
boot = self._bootstrap('etc/drivers_storage_invalid.conf')
self.assertRaises(exceptions.InvalidDriver,
self.assertRaises(errors.InvalidDriver,
lambda: boot.storage)
def test_storage_sqlite(self):
@ -45,7 +45,7 @@ class TestBootstrap(base.TestBase):
def test_transport_invalid(self):
boot = self._bootstrap('etc/drivers_transport_invalid.conf')
self.assertRaises(exceptions.InvalidDriver,
self.assertRaises(errors.InvalidDriver,
lambda: boot.transport)
def test_transport_wsgi(self):