plugin XEP-0045: show join error even if it's not a StanzaError, log it with warning instead of error

This commit is contained in:
Goffi 2019-12-20 12:28:04 +01:00
commit 26c01ca4dc

View file

@ -280,12 +280,12 @@ class XEP_0045(object):
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 @@ class XEP_0045(object):
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)