diff sat/plugins/plugin_xep_0045.py @ 3086:13be04a70e2f

plugin XEP-0045: show join error even if it's not a StanzaError, log it with warning instead of error
author Goffi <goffi@goffi.org>
date Fri, 20 Dec 2019 12:28:04 +0100
parents 16925f494820
children ab7e8ade848a
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0045.py	Fri Dec 20 12:28:01 2019 +0100
+++ b/sat/plugins/plugin_xep_0045.py	Fri Dec 20 12:28:04 2019 +0100
@@ -280,12 +280,12 @@
                          msg=_('Error while configuring the room: {failure_}'))
         return room.fully_joined
 
-    def _joinEb(self, failure, client, room_jid, nick, password):
+    def _joinEb(self, failure_, client, room_jid, nick, password):
         """Called when something is going wrong when joining the room"""
         try:
-            condition = failure.value.condition
+            condition = failure_.value.condition
         except AttributeError:
-            msg_suffix = ''
+            msg_suffix = f': {failure_}'
         else:
             if condition == 'conflict':
                 # we have a nickname conflict, we try again with "_" suffixed to current nickname
@@ -300,11 +300,11 @@
                 d.addCallback(self._passwordUICb, client, room_jid, nick)
                 return d
 
-            msg_suffix = ' with condition "{}"'.format(failure.value.condition)
+            msg_suffix = ' with condition "{}"'.format(failure_.value.condition)
 
         mess = D_("Error while joining the room {room}{suffix}".format(
             room = room_jid.userhost(), suffix = msg_suffix))
-        log.error(mess)
+        log.warning(mess)
         xmlui = xml_tools.note(mess, D_("Group chat error"), level=C.XMLUI_DATA_LVL_ERROR)
         self.host.actionNew({'xmlui': xmlui.toXml()}, profile=client.profile)