feat(core): Stop an exception in a handler to deadlock the connection

This commit is contained in:
PapaTutuWawa 2023-09-29 20:50:03 +02:00
parent 0a68f09fb4
commit 41b789fa28
2 changed files with 10 additions and 1 deletions

View File

@ -23,6 +23,9 @@
- *BREAKING*: `UserAvatarManager`'s `getAvatarId` with `getLatestMetadata`.
- The `PubSubManager` now supports PubSub's `max_items` in `getItems`.
- *BREAKING*: `vCardManager`'s `VCardAvatarUpdatedEvent` no longer automatically requests the newest VCard avatar.
- *BREAKING*: `XmppConnection` now tries to ensure that incoming data is processed in-order. The only exception are awaited stanzas as they are allowed to bypass the queue.
- *BREAKING*: If a stanza handler causes an exception, the handler is simply skipped while processing.
- Add better logging around what stanza handler is running and if they end processing early.
## 0.3.1

View File

@ -685,7 +685,13 @@ class XmppConnection {
_log.finest(
'Running handler for ${stanza.tag} (${stanza.attributes["id"]}) of $managerName',
);
state = await handler.callback(state.stanza, state);
try {
state = await handler.callback(state.stanza, state);
} catch (ex) {
_log.severe(
'Handler from $managerName for ${stanza.tag} (${stanza.attributes["id"]}) failed with "$ex"',
);
}
if (state.done || state.cancel) {
_log.finest(
'Processing ended early for ${stanza.tag} (${stanza.attributes["id"]}) by $managerName',