diff --git a/sat/plugins/plugin_xep_0384.py b/sat/plugins/plugin_xep_0384.py index aaf28740..cbe1a6d6 100644 --- a/sat/plugins/plugin_xep_0384.py +++ b/sat/plugins/plugin_xep_0384.py @@ -634,11 +634,9 @@ class OMEMO(object): 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 @@ class OMEMO(object): 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,