Mercurial > libervia-backend
changeset 3142:cd90c24b2836
plugin XEP-0384: fixed exception catching on getItems
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 29 Jan 2020 18:31:47 +0100 |
parents | 49962f9a238a |
children | 830fce0db15d |
files | sat/plugins/plugin_xep_0384.py |
diffstat | 1 files changed, 11 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- 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,