truncated long domains in error messages; updated error messages

This commit is contained in:
David Kennedy 2023-11-02 15:37:35 -04:00
parent 3ff961cdac
commit e7a3001409
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
2 changed files with 6 additions and 2 deletions

View file

@ -365,7 +365,9 @@ class Domain(TimeStampedModel, DomainHelper):
for addr in ip: for addr in ip:
if not cls._valid_ip_addr(addr): if not cls._valid_ip_addr(addr):
raise NameserverError( raise NameserverError(
code=nsErrorCodes.INVALID_IP, nameserver=nameserver, ip=ip code=nsErrorCodes.INVALID_IP,
nameserver=nameserver[:40],
ip=ip
) )
return None return None

View file

@ -106,7 +106,9 @@ class NameserverError(Exception):
NameserverErrorCodes.MISSING_HOST: ( NameserverErrorCodes.MISSING_HOST: (
"Name server must be provided to enter IP address." "Name server must be provided to enter IP address."
), ),
NameserverErrorCodes.INVALID_HOST: ("Name server, {}, is not valid."), NameserverErrorCodes.INVALID_HOST: (
"Enter a name server in the required format, like ns1.example.com"
),
} }
def __init__(self, *args, code=None, nameserver=None, ip=None, **kwargs): def __init__(self, *args, code=None, nameserver=None, ip=None, **kwargs):