diff sat_frontends/jp/base.py @ 3765:ea204216a505

CLI: don't fail when calling `getContacts` with a component profile
author Goffi <goffi@goffi.org>
date Fri, 13 May 2022 19:15:30 +0200
parents 09f5ac48ffe3
children 3260401fdb98
line wrap: on
line diff
--- a/sat_frontends/jp/base.py	Fri May 13 19:12:33 2022 +0200
+++ b/sat_frontends/jp/base.py	Fri May 13 19:15:30 2022 +0200
@@ -801,7 +801,17 @@
         names2jid = {}
         nodes2jid = {}
 
-        for contact in await self.bridge.getContacts(self.profile):
+        try:
+            contacts = await self.bridge.getContacts(self.profile)
+        except BridgeException as e:
+            if e.classname == "AttributeError":
+                # we may get an AttributeError if we use a component profile
+                # as components don't have roster
+                contacts = []
+            else:
+                raise e
+
+        for contact in contacts:
             jid_s, attr, groups = contact
             _jid = JID(jid_s)
             try: