Catch 403 error when getting offline user presence
It's possible to get a MatrixForbidden error when trying to retrieve a offline room member's presence, if that member actually left the room but the server hasn't yet sent the update.
This commit is contained in:
parent
a402c7657a
commit
8c1d7a868e
|
@ -36,8 +36,8 @@ from nio.crypto import async_generator_from_data
|
|||
from . import __app_name__, __display_name__, utils
|
||||
from .errors import (
|
||||
BadMimeType, InvalidUserId, InvalidUserInContext, MatrixBadGateway,
|
||||
MatrixError, MatrixNotFound, MatrixTooLarge, MatrixUnauthorized,
|
||||
UneededThumbnail, UserFromOtherServerDisallowed,
|
||||
MatrixError, MatrixForbidden, MatrixNotFound, MatrixTooLarge,
|
||||
MatrixUnauthorized, UneededThumbnail, UserFromOtherServerDisallowed,
|
||||
)
|
||||
from .html_markdown import HTML_PROCESSOR as HTML
|
||||
from .media_cache import Media, Thumbnail
|
||||
|
@ -1389,8 +1389,11 @@ class MatrixClient(nio.AsyncClient):
|
|||
if not self.models["accounts"][self.user_id].presence_support:
|
||||
return
|
||||
|
||||
async with self.backend.concurrent_get_presence_limit:
|
||||
resp = await self.get_presence(user_id)
|
||||
try:
|
||||
async with self.backend.concurrent_get_presence_limit:
|
||||
resp = await self.get_presence(user_id)
|
||||
except MatrixForbidden:
|
||||
return
|
||||
|
||||
await self.nio_callbacks.onPresenceEvent(nio.PresenceEvent(
|
||||
user_id = resp.user_id,
|
||||
|
|
Loading…
Reference in New Issue
Block a user