mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-05 03:57:25 +02:00
Make class function for GenericError mapping
This commit is contained in:
parent
c3a23c23fa
commit
578f5bac1a
2 changed files with 5 additions and 1 deletions
|
@ -31,7 +31,7 @@ DOMAIN_API_MESSAGES = {
|
||||||
),
|
),
|
||||||
"invalid": "Enter a domain using only letters, numbers, or hyphens (though we don't recommend using hyphens).",
|
"invalid": "Enter a domain using only letters, numbers, or hyphens (though we don't recommend using hyphens).",
|
||||||
"success": "That domain is available!",
|
"success": "That domain is available!",
|
||||||
"error": GenericError._error_mapping[GenericErrorCodes.CANNOT_CONTACT_REGISTRY],
|
"error": GenericError.get_error_mapping(GenericErrorCodes.CANNOT_CONTACT_REGISTRY),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,10 @@ contact help@get.gov.
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.message}"
|
return f"{self.message}"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_error_mapping(self, code=None):
|
||||||
|
return self._error_mapping.get(code)
|
||||||
|
|
||||||
|
|
||||||
class NameserverErrorCodes(IntEnum):
|
class NameserverErrorCodes(IntEnum):
|
||||||
"""Used in the NameserverError class for
|
"""Used in the NameserverError class for
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue