diff --git a/src/api/views.py b/src/api/views.py index 93d27a382..85ae021c9 100644 --- a/src/api/views.py +++ b/src/api/views.py @@ -64,7 +64,7 @@ def check_domain_available(domain): The given domain is lowercased to match against the domains list. If the given domain doesn't end with .gov, ".gov" is added when looking for - a match. + a match. If check fails, throws a RegistryError. """ Domain = apps.get_model("registrar.Domain") if domain.endswith(".gov"): diff --git a/src/registrar/models/utility/domain_helper.py b/src/registrar/models/utility/domain_helper.py index 14cae53bc..c8419ca54 100644 --- a/src/registrar/models/utility/domain_helper.py +++ b/src/registrar/models/utility/domain_helper.py @@ -40,8 +40,8 @@ class DomainHelper: try: if not check_domain_available(domain): raise errors.DomainUnavailableError() - except Exception: - raise errors.RegistrySystemError() + except RegistryError as err: + raise errors.RegistrySystemError() from err return domain @classmethod