Code cleanup

This commit is contained in:
zandercymatics 2023-11-20 08:58:27 -07:00
parent 2659cd816b
commit e853d4ef16
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 55 additions and 41 deletions

View file

@ -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.