Skip to content

Commit

Permalink
Catch exception from upgrade_to_bot_account() (#1030)
Browse files Browse the repository at this point in the history
The call to Lichess.upgrade_to_bot_account() does not return a value. Failure is signaled by an exception. Fix the call to upgrade_account() in lib/lichess_bot.py to reflect this.
  • Loading branch information
MarkZH authored Oct 7, 2024
1 parent 64b873c commit ccde168
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/lichess_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ def signal_handler(signal: int, frame: Optional[FrameType]) -> None:

def upgrade_account(li: LICHESS_TYPE) -> bool:
"""Upgrade the account to a BOT account."""
if li.upgrade_to_bot_account() is None:
try:
li.upgrade_to_bot_account()
except HTTPError:
logger.exception("Failed to upgrade to Bot Account.")
return False

logger.info("Successfully upgraded to Bot Account!")
Expand Down

0 comments on commit ccde168

Please sign in to comment.