Don't trigger error_callback for known exc

When AMQPDestinationNotFound is raised, we must not
call the error_callback method. The exception is logged
only if needed in upper layer (amqpdriver.py).

Related-bug: #1524418
Related-bug: #1521958

(cherry picked from commit Ic1ddec2d13172532dbaa572d04a4c22c97ac4fe7)

Change-Id: I4bc323f0b9578cfd4972f882d6fbf59b9064ca53
This commit is contained in:
Mehdi Abaakouk 2015-12-09 18:49:19 +01:00
parent 53256e990d
commit 8093aefaae
2 changed files with 8 additions and 0 deletions

View File

@ -256,3 +256,7 @@ def _add_unique_id(msg):
unique_id = uuid.uuid4().hex
msg.update({UNIQUE_ID: unique_id})
LOG.debug('UNIQUE_ID is %s.', unique_id)
class AMQPDestinationNotFound(Exception):
pass

View File

@ -878,6 +878,10 @@ class Connection(object):
'retry': retry}
LOG.error(msg)
raise exceptions.MessageDeliveryFailure(msg)
except rpc_amqp.AMQPDestinationNotFound:
# NOTE(sileht): we must reraise this without
# trigger error_callback
raise
except Exception as exc:
error_callback and error_callback(exc)
raise