diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/consumer_async.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/consumer_async.py index d3651a1c9d8f..3aa1a7d6bbe5 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/consumer_async.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/consumer_async.py @@ -93,6 +93,7 @@ def __aiter__(self): async def __anext__(self): retried_times = 0 + last_exception = None while retried_times < self._client._config.max_retries: # pylint:disable=protected-access try: await self._open() @@ -108,6 +109,8 @@ async def __anext__(self): await self._client._try_delay(retried_times=retried_times, last_exception=last_exception, # pylint:disable=protected-access entity_name=self._name) retried_times += 1 + log.info("%r operation has exhausted retry. Last exception: %r.", self._name, last_exception) + raise last_exception def _create_handler(self): alt_creds = { diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/consumer.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/consumer.py index 0e89ba9bc55f..499c3ba5429e 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/consumer.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/consumer.py @@ -89,6 +89,7 @@ def __iter__(self): def __next__(self): retried_times = 0 + last_exception = None while retried_times < self._client._config.max_retries: # pylint:disable=protected-access try: self._open() @@ -104,6 +105,8 @@ def __next__(self): self._client._try_delay(retried_times=retried_times, last_exception=last_exception, # pylint:disable=protected-access entity_name=self._name) retried_times += 1 + log.info("%r operation has exhausted retry. Last exception: %r.", self._name, last_exception) + raise last_exception def _create_handler(self): alt_creds = {