diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2021-11-18 15:33:37 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2021-11-18 15:33:37 +0100 |
commit | ed514e6f73298f5b24a6d6940584e4c8316fc759 (patch) | |
tree | 90920d330d2ae492d17b860f7e670afefc20ca80 | |
parent | d4067275ff0eb646afaac2b0cbc9f351349ba9c0 (diff) | |
download | slixmpp-ed514e6f73298f5b24a6d6940584e4c8316fc759.tar.gz slixmpp-ed514e6f73298f5b24a6d6940584e4c8316fc759.tar.bz2 slixmpp-ed514e6f73298f5b24a6d6940584e4c8316fc759.tar.xz slixmpp-ed514e6f73298f5b24a6d6940584e4c8316fc759.zip |
jid: Improve error reporting on IDNA validation failure
At least knowing the failing domain should help a lot while debugging.
-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') |