Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

Commit

Permalink
Ignore errors redacting login command
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Feb 25, 2021
1 parent 797e72a commit e8b91b3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mautrix_facebook/commands/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import asyncio

from mautrix.client import Client
from mautrix.errors import MForbidden
from mautrix.bridge.commands import HelpSection, command_handler
from mautrix.bridge import custom_puppet as cpu

Expand Down Expand Up @@ -61,7 +62,10 @@ async def login(evt: CommandEvent) -> None:
return

email, password = evt.args[0], " ".join(evt.args[1:])
await evt.az.intent.redact(evt.room_id, evt.event_id)
try:
await evt.az.intent.redact(evt.room_id, evt.event_id)
except MForbidden:
pass

if evt.sender.client:
await evt.reply("You're already logged in")
Expand Down Expand Up @@ -92,9 +96,9 @@ async def login(evt: CommandEvent) -> None:
except OAuthException as e:
await evt.reply(f"Error from Messenger:\n\n> {e}")
except Exception as e:
evt.log.exception("Failed to log in")
evt.sender.command_status = None
await evt.reply(f"Failed to log in: {e}")
evt.log.exception("Failed to log in")


async def enter_2fa_code(evt: CommandEvent) -> None:
Expand All @@ -114,9 +118,9 @@ async def enter_2fa_code(evt: CommandEvent) -> None:
await evt.reply(f"Error from Messenger:\n\n> {e}")
evt.sender.command_status = None
except Exception as e:
evt.log.exception("Failed to log in")
evt.sender.command_status = None
await evt.reply(f"Failed to log in: {e}")
evt.log.exception("Failed to log in")


@command_handler(needs_auth=True, help_section=SECTION_AUTH, help_text="Log out of Facebook")
Expand Down

0 comments on commit e8b91b3

Please sign in to comment.