Skip to content

Conversation

@AndrewFerr
Copy link
Contributor

CryptoClient#onRoomEvent may throw when looking up the members of a room with a client that isn't in the room, which can happen if appservice namespaces are broad & the appservice receives events for rooms that some of its managed clients are not members of.

Checklist

  • Tests written for all new code
    • Not adding a test for this until there are tests for appservice crypto.
  • Linter has been satisfied

CryptoClient#onRoomEvent may throw when looking up the members of a room
with a client that isn't in the room, which can happen if appservice
namespaces are broad & the appservice receives events for rooms that
some of its managed clients are not members of.
because:
- the failure will print its own logs
- the point of catching this is that it's _not_ an error
because the failure already logs the error
await this.engine.addTrackedUsers(members.map(e => e.membershipFor));
return this.client.getRoomMembers(roomId, null, ['join', 'invite']).then(
members => this.engine.addTrackedUsers(members.map(e => e.membershipFor)),
e => void LogService.warn("CryptoClient", `Unable to get members of room ${roomId}`),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we use a try/catch pattern here using async/await.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants