# HG changeset patch # User Goffi # Date 1663792356 -7200 # Node ID 1e64f1ed3ebd5d978bb2046ec4fef5fb01838642 # Parent 022ae35a9d8260c43f98ea4162c7550b1032a522 plugin XEP-0060: raise an `NotFound` exception instead of StanzaError in `subscribe`: `exceptions.NotFound` is now raised in stead of `item-not-found` `StanzaError` for consistency with `getItems` and because it's easier to catch (condition has to be checked when `StanzaError` is received). rel 372 diff -r 022ae35a9d82 -r 1e64f1ed3ebd sat/plugins/plugin_xep_0060.py --- a/sat/plugins/plugin_xep_0060.py Wed Sep 21 22:29:54 2022 +0200 +++ b/sat/plugins/plugin_xep_0060.py Wed Sep 21 22:32:36 2022 +0200 @@ -1207,10 +1207,16 @@ ) if not cont: return trigger_sub - subscription = await client.pubsub_client.subscribe( - service, nodeIdentifier, sub_jid or client.jid.userhostJID(), options=options, - sender=client.jid.userhostJID() - ) + try: + subscription = await client.pubsub_client.subscribe( + service, nodeIdentifier, sub_jid or client.jid.userhostJID(), + options=options, sender=client.jid.userhostJID() + ) + except error.StanzaError as e: + if e.condition == 'item-not-found': + raise exceptions.NotFound(e.text or e.condition) + else: + raise e return subscription def _unsubscribe(self, service, nodeIdentifier, profile_key=C.PROF_KEY_NONE):