diff src/plugins/plugin_xep_0045.py @ 1742:244a605623d6

complete the Exception's list when catching JID error: - Twisted JID constructor raises not only jid.InvalidFormat but also RuntimeError and AttributeError
author souliane <souliane@mailoo.org>
date Tue, 15 Dec 2015 13:30:47 +0100
parents 0502a1fbe8b5
children d17772b0fe22
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0045.py	Fri Dec 11 09:12:11 2015 +0100
+++ b/src/plugins/plugin_xep_0045.py	Tue Dec 15 13:30:47 2015 +0100
@@ -562,7 +562,7 @@
             entity_jid = jid.JID(jid_s).userhostJID()
             assert(entity_jid.user)
             assert(entity_jid.host)
-        except (IndexError, jid.InvalidFormat, AssertionError):
+        except (RuntimeError, jid.InvalidFormat, AttributeError, IndexError, AssertionError):
             feedback = _(u"You must provide a valid JID to ban, like in '/ban contact@example.net'")
             self.host.plugins[C.TEXT_CMDS].feedBack(feedback, mess_data, profile)
             return False
@@ -594,7 +594,7 @@
             entity_jid = jid.JID(jid_s).userhostJID()
             assert(entity_jid.user)
             assert(entity_jid.host)
-        except (IndexError, jid.InvalidFormat, AssertionError):
+        except (RuntimeError, jid.InvalidFormat, AttributeError, IndexError, AssertionError):
             feedback = _(u"You must provide a valid JID to affiliate, like in '/affiliate contact@example.net member'")
             self.host.plugins[C.TEXT_CMDS].feedBack(feedback, mess_data, profile)
             return False