From f2c82419c81deee698296c32d95cfbf7c0b40a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scharnitzky=20Don=C3=A1t?= Date: Wed, 1 Apr 2020 01:02:33 +0200 Subject: [PATCH] added minimal excpetion handling to communicator.py --- communicator.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/communicator.py b/communicator.py index 8328ad1..be1fc67 100644 --- a/communicator.py +++ b/communicator.py @@ -43,11 +43,14 @@ class Communicator: Get the list of available consumer from the current primary consumer. :return: """ - currentconsumer = self.currenctconsumer - response = requests.get(f'http://{currentconsumer}/consumer') - json = response.json() - LOGGER.debug(f"List of currently available consumers: {json}") - return json + try: + currentconsumer = self.currenctconsumer + response = requests.get(f'http://{currentconsumer}/consumer') + json = response.json() + LOGGER.debug(f"List of currently available consumers: {json}") + return json + except Exception: + return [] def isconsumeravailable(self) -> bool: """