Handle RPCErrors in formatter and update mautrix-python

This commit is contained in:
Tulir Asokan
2019-08-17 13:43:10 +03:00
parent d3e6860b1c
commit de4c16431d
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -26,6 +26,7 @@ from telethon.tl.types import (MessageEntityMention, MessageEntityMentionName, M
MessageEntityBlockquote, MessageEntityStrike, MessageFwdHeader,
MessageEntityUnderline, PeerUser)
from telethon.tl.custom import Message
from telethon.errors import RPCError
from telethon.helpers import add_surrogate, del_surrogate
from mautrix.errors import MatrixRequestError
@@ -80,7 +81,7 @@ async def _add_forward_header(source: 'AbstractUser', content: TextMessageEventC
if user:
fwd_from_text = pu.Puppet.get_displayname(user, False)
fwd_from_html = f"<b>{escape(fwd_from_text)}</b>"
except ValueError:
except (ValueError, RPCError):
fwd_from_text = fwd_from_html = "unknown user"
elif fwd_from.channel_id:
portal = po.Portal.get_by_tgid(TelegramID(fwd_from.channel_id))
@@ -97,7 +98,7 @@ async def _add_forward_header(source: 'AbstractUser', content: TextMessageEventC
if channel:
fwd_from_text = f"channel {channel.title}"
fwd_from_html = f"channel <b>{escape(channel.title)}</b>"
except ValueError:
except (ValueError, RPCError):
fwd_from_text = fwd_from_html = "unknown channel"
elif fwd_from.from_name:
fwd_from_text = fwd_from.from_name
+1 -1
View File
@@ -32,7 +32,7 @@ setuptools.setup(
install_requires=[
"aiohttp>=3.0.1,<4",
"mautrix>=0.4.0.dev59,<0.5",
"mautrix>=0.4.0.dev60,<0.5",
"SQLAlchemy>=1.2.3,<2",
"alembic>=1.0.0,<2",
"commonmark>=0.8.1,<1",