diff sat/plugins/plugin_xep_0329.py @ 3355:33d9b38b5890

plugin XEP-0329: better error handling in `onComponentAffiliationsGet`
author Goffi <goffi@goffi.org>
date Mon, 14 Sep 2020 09:23:23 +0200
parents ac9342f359e9
children 000b6722bd35
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0329.py	Sun Sep 13 22:49:12 2020 +0200
+++ b/sat/plugins/plugin_xep_0329.py	Mon Sep 14 09:23:23 2020 +0200
@@ -827,6 +827,12 @@
             peer_jid, owner = self._compParseJids(client, iq_elt)
             is_owner = peer_jid.userhostJID() == owner
             affiliations = {owner: 'owner'}
+        except exceptions.NotFound:
+            client.sendError(iq_elt, "item-not-found")
+            return
+        except Exception as e:
+            client.sendError(iq_elt, "internal-server-error", str(e))
+            return
         else:
             from_jid_bare = from_jid.userhostJID()
             is_owner = from_jid_bare == file_data.get('owner')