changeset 1248:77a4592816f6

plugin XEP-0054: fixes error message when we get a ConnectionLost failure
author souliane <souliane@mailoo.org>
date Sun, 19 Oct 2014 15:25:04 +0200
parents c6cf44e6330b
children 3be9d8ab2e15
files src/plugins/plugin_xep_0054.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0054.py	Sun Oct 19 15:07:16 2014 +0200
+++ b/src/plugins/plugin_xep_0054.py	Sun Oct 19 15:25:04 2014 +0200
@@ -204,8 +204,11 @@
 
     def vcard_err(self, failure, profile):
         """Called when something is wrong with registration"""
-        if failure.value.stanza.hasAttribute("from"):
-            log.error(_("Can't find VCard of %s") % failure.value.stanza['from'])
+        try:
+            if failure.value.stanza.hasAttribute("from"):
+                log.error(_("Can't find VCard of %s") % failure.value.stanza['from'])
+        except AttributeError:
+            log.error(_("Can't find VCard: %s") % failure.getErrorMessage())
         self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile)  # FIXME: maybe an error message would be better
 
     def getCard(self, target_s, profile_key=C.PROF_KEY_NONE):