# HG changeset patch # User Goffi # Date 1580319107 -3600 # Node ID cd90c24b2836a66ace491a0da0d04d2054f7ba8a # Parent 49962f9a238a2626b6ecd5e69d04762bb02e6c9a plugin XEP-0384: fixed exception catching on getItems diff -r 49962f9a238a -r cd90c24b2836 sat/plugins/plugin_xep_0384.py --- a/sat/plugins/plugin_xep_0384.py Wed Jan 29 17:39:00 2020 +0100 +++ b/sat/plugins/plugin_xep_0384.py Wed Jan 29 18:31:47 2020 +0100 @@ -634,11 +634,9 @@ assert not entity_jid.resource try: items, metadata = yield self._p.getItems(client, entity_jid, NS_OMEMO_DEVICES) - except error.StanzaError as e: - if e.condition == 'item-not-found': - log.info(_("there is no node to handle OMEMO devices")) - defer.returnValue(set()) - raise e + except exceptions.NotFound: + log.info(_("there is no node to handle OMEMO devices")) + defer.returnValue(set()) devices = self.parseDevices(items) defer.returnValue(devices) @@ -677,16 +675,15 @@ node = NS_OMEMO_BUNDLE.format(device_id=device_id) try: items, metadata = yield self._p.getItems(client, entity_jid, node) + except exceptions.NotFound: + log.warning(_("Bundle missing for device {device_id}") + .format(device_id=device_id)) + missing.add(device_id) + continue except error.StanzaError as e: - if e.condition == "item-not-found": - log.warning(_("Bundle missing for device {device_id}") - .format(device_id=device_id)) - missing.add(device_id) - continue - else: - log.warning(_("Can't get bundle for device {device_id}: {reason}") - .format(device_id=device_id, reason=e)) - continue + log.warning(_("Can't get bundle for device {device_id}: {reason}") + .format(device_id=device_id, reason=e)) + continue if not items: log.warning(_("no item found in node {node}, can't get public bundle " "for deviceĀ {device_id}").format(node=node,