mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-03 00:12:16 +02:00
Code cleanup
This commit is contained in:
parent
2659cd816b
commit
e853d4ef16
2 changed files with 55 additions and 41 deletions
|
@ -57,6 +57,33 @@ contact help@get.gov
|
|||
return f"{self.message}"
|
||||
|
||||
|
||||
class LoadOrganizationErrorCodes(IntEnum):
|
||||
TRANSITION_DOMAINS_NOT_FOUND = 1
|
||||
UPDATE_DOMAIN_INFO_FAILED = 2
|
||||
|
||||
|
||||
class LoadOrganizationError(Exception):
|
||||
"""
|
||||
Error class used in the load_organization_data script
|
||||
"""
|
||||
|
||||
_error_mapping = {
|
||||
LoadOrganizationErrorCodes.TRANSITION_DOMAINS_NOT_FOUND: (
|
||||
"Could not find all desired TransitionDomains. " "(Possible data corruption?)"
|
||||
),
|
||||
LoadOrganizationErrorCodes.UPDATE_DOMAIN_INFO_FAILED: "Failed to update DomainInformation",
|
||||
}
|
||||
|
||||
def __init__(self, *args, code=None, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.code = code
|
||||
if self.code in self._error_mapping:
|
||||
self.message = self._error_mapping.get(self.code)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.message}"
|
||||
|
||||
|
||||
class NameserverErrorCodes(IntEnum):
|
||||
"""Used in the NameserverError class for
|
||||
error mapping.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue