diff options
author | mathieui <mathieui@mathieui.net> | 2022-02-04 23:07:51 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2022-02-04 23:07:51 +0100 |
commit | 9eb4462accb4367a2577cbf70e683731a552d27a (patch) | |
tree | 9f73aec0896b99be1439217321ae7127843d1035 | |
parent | d5502c9be70c850a6c4d2dcf1f7cca672c4da6a0 (diff) | |
parent | ed514e6f73298f5b24a6d6940584e4c8316fc759 (diff) | |
download | slixmpp-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.py | 8 |
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') |