aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar S. Co1 <[email protected]>2020-03-01 13:59:17 -0500
committerGravatar S. Co1 <[email protected]>2020-03-01 13:59:17 -0500
commit9cca41b5d8943212b38eae3ae78e6472577ba6c1 (patch)
tree72571dcb62060467a8ccddc9af0a95a83eccc1c1
parentBump Dependencies & Relock (diff)
Move syncer confirmation reaction check out of finally clause
Returning directly out of a `finally` clause can cause any exceptions raised in the clause to be discarded, so we can remove the finally clause entirely and shift the control statements into the body of the function
-rw-r--r--bot/cogs/sync/syncers.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/bot/cogs/sync/syncers.py b/bot/cogs/sync/syncers.py
index d6891168f..c7ce54d65 100644
--- a/bot/cogs/sync/syncers.py
+++ b/bot/cogs/sync/syncers.py
@@ -125,17 +125,17 @@ class Syncer(abc.ABC):
except TimeoutError:
# reaction will remain none thus sync will be aborted in the finally block below.
log.debug(f"The {self.name} syncer confirmation prompt timed out.")
- finally:
- if str(reaction) == constants.Emojis.check_mark:
- log.trace(f"The {self.name} syncer was confirmed.")
- await message.edit(content=f':ok_hand: {mention}{self.name} sync will proceed.')
- return True
- else:
- log.warning(f"The {self.name} syncer was aborted or timed out!")
- await message.edit(
- content=f':warning: {mention}{self.name} sync aborted or timed out!'
- )
- return False
+
+ if str(reaction) == constants.Emojis.check_mark:
+ log.trace(f"The {self.name} syncer was confirmed.")
+ await message.edit(content=f':ok_hand: {mention}{self.name} sync will proceed.')
+ return True
+ else:
+ log.warning(f"The {self.name} syncer was aborted or timed out!")
+ await message.edit(
+ content=f':warning: {mention}{self.name} sync aborted or timed out!'
+ )
+ return False
@abc.abstractmethod
async def _get_diff(self, guild: Guild) -> _Diff: