From dc83d9e46881b87c15180a055d99e8a1e2cd820d Mon Sep 17 00:00:00 2001 From: novokrest Date: Sat, 2 Jun 2018 11:58:28 +0300 Subject: [PATCH] beeminder: Remove duplicated try-except in `initialize` method. Remove duplicated try-except in `initialize` method because ConnectionError is already catched in `get_beeminder_response` method. --- zulip_bots/zulip_bots/bots/beeminder/beeminder.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/zulip_bots/zulip_bots/bots/beeminder/beeminder.py b/zulip_bots/zulip_bots/bots/beeminder/beeminder.py index 605ce76..a298d86 100644 --- a/zulip_bots/zulip_bots/bots/beeminder/beeminder.py +++ b/zulip_bots/zulip_bots/bots/beeminder/beeminder.py @@ -83,13 +83,9 @@ class BeeminderHandler(object): def initialize(self, bot_handler: Any) -> None: self.config_info = bot_handler.get_config_info('beeminder') # Check for valid auth_token - try: - result = get_beeminder_response('5', self.config_info) - if result == "Error. Check your key!": - bot_handler.quit('Invalid key!') - except ConnectionError: - logging.warning('Bad connection') - raise + result = get_beeminder_response('5', self.config_info) + if result == "Error. Check your key!": + bot_handler.quit('Invalid key!') def usage(self) -> str: return "This plugin allows users to add datapoints towards their Beeminder goals"