summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2022-02-04 23:07:51 +0100
committermathieui <mathieui@mathieui.net>2022-02-04 23:07:51 +0100
commit9eb4462accb4367a2577cbf70e683731a552d27a (patch)
tree9f73aec0896b99be1439217321ae7127843d1035
parentd5502c9be70c850a6c4d2dcf1f7cca672c4da6a0 (diff)
parented514e6f73298f5b24a6d6940584e4c8316fc759 (diff)
downloadslixmpp-9eb4462accb4367a2577cbf70e683731a552d27a.tar.gz
slixmpp-9eb4462accb4367a2577cbf70e683731a552d27a.tar.bz2
slixmpp-9eb4462accb4367a2577cbf70e683731a552d27a.tar.xz
slixmpp-9eb4462accb4367a2577cbf70e683731a552d27a.zip
Merge branch 'better-jid-errors' into 'master'
jid: Improve error reporting on IDNA validation failure See merge request poezio/slixmpp!170
-rw-r--r--slixmpp/jid.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/slixmpp/jid.py b/slixmpp/jid.py
index adde95a4..d02f98a3 100644
--- a/slixmpp/jid.py
+++ b/slixmpp/jid.py
@@ -133,15 +133,15 @@ def _validate_domain(domain: str):
try:
domain = idna(domain)
except StringprepError:
- raise InvalidJID('idna validation failed')
+ raise InvalidJID(f'idna validation failed: {domain}')
if ':' in domain:
- raise InvalidJID('Domain containing a port')
+ raise InvalidJID(f'Domain containing a port: {domain}')
for label in domain.split('.'):
if not label:
- raise InvalidJID('Domain containing too many dots')
+ raise InvalidJID(f'Domain containing too many dots: {domain}')
if '-' in (label[0], label[-1]):
- raise InvalidJID('Domain started or ended with -')
+ raise InvalidJID(f'Domain starting or ending with -: {domain}')
if not domain:
raise InvalidJID('Domain must not be 0 bytes')