From 737c5f966557ada2cf10fa0d8f3c19671ae96348 Mon Sep 17 00:00:00 2001 From: annatisch Date: Sun, 3 Mar 2019 13:38:22 -0800 Subject: [PATCH] Fixed bug in error handling (#100) --- azure/eventhub/async_ops/receiver_async.py | 4 ++-- azure/eventhub/async_ops/sender_async.py | 4 ++-- azure/eventhub/receiver.py | 2 +- azure/eventhub/sender.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/azure/eventhub/async_ops/receiver_async.py b/azure/eventhub/async_ops/receiver_async.py index 9a09091..c57db34 100644 --- a/azure/eventhub/async_ops/receiver_async.py +++ b/azure/eventhub/async_ops/receiver_async.py @@ -159,8 +159,8 @@ async def _reconnect_async(self): # pylint: disable=too-many-statements if str(shutdown).startswith("Unable to open authentication session") and self.auto_reconnect: log.info("AsyncReceiver couldn't authenticate. Attempting reconnect.") return False - log.info("AsyncReceiver connection error (%r). Shutting down.", e) - error = EventHubError(str(shutdown), shutdown) + log.info("AsyncReceiver connection error (%r). Shutting down.", shutdown) + error = EventHubError(str(shutdown)) await self.close_async(exception=error) raise error except Exception as e: diff --git a/azure/eventhub/async_ops/sender_async.py b/azure/eventhub/async_ops/sender_async.py index 6fc786d..066baf3 100644 --- a/azure/eventhub/async_ops/sender_async.py +++ b/azure/eventhub/async_ops/sender_async.py @@ -144,8 +144,8 @@ async def _reconnect_async(self): if str(shutdown).startswith("Unable to open authentication session") and self.auto_reconnect: log.info("AsyncSender couldn't authenticate. Attempting reconnect.") return False - log.info("AsyncSender connection error (%r). Shutting down.", e) - error = EventHubError(str(shutdown), shutdown) + log.info("AsyncSender connection error (%r). Shutting down.", shutdown) + error = EventHubError(str(shutdown)) await self.close_async(exception=error) raise error except Exception as e: diff --git a/azure/eventhub/receiver.py b/azure/eventhub/receiver.py index 9cd6c6f..8f46db3 100644 --- a/azure/eventhub/receiver.py +++ b/azure/eventhub/receiver.py @@ -154,7 +154,7 @@ def _reconnect(self): # pylint: disable=too-many-statements if str(shutdown).startswith("Unable to open authentication session") and self.auto_reconnect: log.info("Receiver couldn't authenticate. Attempting reconnect.") return False - log.info("Receiver connection error (%r). Shutting down.", e) + log.info("Receiver connection error (%r). Shutting down.", shutdown) error = EventHubError(str(shutdown)) self.close(exception=error) raise error diff --git a/azure/eventhub/sender.py b/azure/eventhub/sender.py index d96ea0c..f3559e2 100644 --- a/azure/eventhub/sender.py +++ b/azure/eventhub/sender.py @@ -137,7 +137,7 @@ def _reconnect(self): if str(shutdown).startswith("Unable to open authentication session") and self.auto_reconnect: log.info("Sender couldn't authenticate. Attempting reconnect.") return False - log.info("Sender connection error (%r). Shutting down.", e) + log.info("Sender connection error (%r). Shutting down.", shutdown) error = EventHubError(str(shutdown)) self.close(exception=error) raise error