BryanDavis has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/394359 )
Change subject: flake8: E722 do not use bare except ...................................................................... flake8: E722 do not use bare except Newer versions of flake8 decided that they are smarter than the developer, so try to make them shut up without opening too many unhandled error cases that will crash the bot. Change-Id: I48b9e9ce776a7ea6d915fa17575383dd3b627914 --- M stashbot/bot.py M stashbot/ldap.py M stashbot/sal.py 3 files changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/labs/tools/stashbot refs/changes/59/394359/1 diff --git a/stashbot/bot.py b/stashbot/bot.py index d293942..f65561a 100644 --- a/stashbot/bot.py +++ b/stashbot/bot.py @@ -208,7 +208,7 @@ continue try: info = self.phab.taskInfo(task) - except: + except Exception: self.logger.exception('Failed to lookup info for %s', task) else: self.respond(conn, event, self.config['phab']['echo'] % info) diff --git a/stashbot/ldap.py b/stashbot/ldap.py index f6e25a4..a22d358 100644 --- a/stashbot/ldap.py +++ b/stashbot/ldap.py @@ -65,7 +65,7 @@ return self.search(*args, retriable=False, **kwargs) else: raise - except: + except Exception: # If anything at all goes wrong, ditch the connection out of # paranoia. We really don't want to have to restart the bot for # dumb things like LDAP hiccups. diff --git a/stashbot/sal.py b/stashbot/sal.py index 27733b6..75f8454 100644 --- a/stashbot/sal.py +++ b/stashbot/sal.py @@ -138,7 +138,7 @@ if respond_to_channel: self.irc.respond( conn, event, 'Logged the message at %s' % url) - except: + except Exception: self.logger.exception('Error writing to wiki') if respond_to_channel: self.irc.respond( @@ -152,7 +152,7 @@ if 'twitter' in channel_conf: try: self._tweet(bang, channel_conf) - except: + except Exception: self.logger.exception('Error writing to twitter') def _log_duplicate(self, conn, event, doc, **kwargs): @@ -221,7 +221,7 @@ return [g.cn for g in res] else: self.logger.error('Failed to get LDAP data for %s', dn) - except: + except Exception: self.logger.exception('Exception getting LDAP data for %s', dn) return [] @@ -240,7 +240,7 @@ for task in m: try: self.phab.comment(task, msg) - except: + except Exception: self.logger.exception('Failed to add note to phab task') def _write_to_wiki(self, bang, channel_conf): -- To view, visit https://gerrit.wikimedia.org/r/394359 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I48b9e9ce776a7ea6d915fa17575383dd3b627914 Gerrit-PatchSet: 1 Gerrit-Project: labs/tools/stashbot Gerrit-Branch: master Gerrit-Owner: BryanDavis <bda...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits