diff --git a/src/epplibwrapper/errors.py b/src/epplibwrapper/errors.py
index 7e45633a7..d34ed5e91 100644
--- a/src/epplibwrapper/errors.py
+++ b/src/epplibwrapper/errors.py
@@ -67,6 +67,13 @@ class RegistryError(Exception):
def should_retry(self):
return self.code == ErrorCode.COMMAND_FAILED
+ # connection errors have error code of None and [Errno 99] in the err message
+ def is_connection_error(self):
+ return self.code is None
+
+ def is_session_error(self):
+ return self.code is not None and (self.code >= 2501 and self.code <= 2502)
+
def is_server_error(self):
return self.code is not None and (self.code >= 2400 and self.code <= 2500)
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
index a75d644b7..e99e767bd 100644
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -745,7 +745,23 @@ class DomainAdmin(ListHeaderAdmin):
obj.place_client_hold()
obj.save()
except Exception as err:
- self.message_user(request, err, messages.ERROR)
+ # if error is an error from the registry, display useful
+ # and readable error
+ if err.code:
+ self.message_user(
+ request,
+ f"Error placing the hold with the registry: {err}",
+ messages.ERROR,
+ )
+ elif err.is_connection_error():
+ self.message_user(
+ request,
+ "Error connecting to the registry",
+ messages.ERROR,
+ )
+ else:
+ # all other type error messages, display the error
+ self.message_user(request, err, messages.ERROR)
else:
self.message_user(
request,
@@ -762,7 +778,23 @@ class DomainAdmin(ListHeaderAdmin):
obj.revert_client_hold()
obj.save()
except Exception as err:
- self.message_user(request, err, messages.ERROR)
+ # if error is an error from the registry, display useful
+ # and readable error
+ if err.code:
+ self.message_user(
+ request,
+ f"Error removing the hold in the registry: {err}",
+ messages.ERROR,
+ )
+ elif err.is_connection_error():
+ self.message_user(
+ request,
+ "Error connecting to the registry",
+ messages.ERROR,
+ )
+ else:
+ # all other type error messages, display the error
+ self.message_user(request, err, messages.ERROR)
else:
self.message_user(
request,
diff --git a/src/registrar/assets/sass/_theme/_uswds-theme-custom-styles.scss b/src/registrar/assets/sass/_theme/_uswds-theme-custom-styles.scss
index 4878235a9..e69b36bb8 100644
--- a/src/registrar/assets/sass/_theme/_uswds-theme-custom-styles.scss
+++ b/src/registrar/assets/sass/_theme/_uswds-theme-custom-styles.scss
@@ -399,6 +399,11 @@ a.usa-button--unstyled:visited {
border-color: color('accent-cool-lighter');
}
+.dotgov-status-box--action-need {
+ background-color: color('warning-lighter');
+ border-color: color('warning');
+}
+
#wrapper {
padding-top: units(3);
padding-bottom: units(6) * 2 ; //Workaround because USWDS units jump from 10 to 15
diff --git a/src/registrar/migrations/0032_alter_transitiondomain_status.py b/src/registrar/migrations/0032_alter_transitiondomain_status.py
index 594f741db..9989058f8 100644
--- a/src/registrar/migrations/0032_alter_transitiondomain_status.py
+++ b/src/registrar/migrations/0032_alter_transitiondomain_status.py
@@ -1,4 +1,4 @@
-# Generated by Django 4.2.1 on 2023-09-26 19:14
+
from django.db import migrations, models
diff --git a/src/registrar/models/domain.py b/src/registrar/models/domain.py
index 13405d9bb..2c7f8703c 100644
--- a/src/registrar/models/domain.py
+++ b/src/registrar/models/domain.py
@@ -634,13 +634,25 @@ class Domain(TimeStampedModel, DomainHelper):
"""This domain should not be active.
may raises RegistryError, should be caught or handled correctly by caller"""
request = commands.UpdateDomain(name=self.name, add=[self.clientHoldStatus()])
- registry.send(request, cleaned=True)
+ try:
+ registry.send(request, cleaned=True)
+ self._invalidate_cache()
+ except RegistryError as err:
+ # if registry error occurs, log the error, and raise it as well
+ logger.error(f"registry error placing client hold: {err}")
+ raise (err)
def _remove_client_hold(self):
"""This domain is okay to be active.
may raises RegistryError, should be caught or handled correctly by caller"""
request = commands.UpdateDomain(name=self.name, rem=[self.clientHoldStatus()])
- registry.send(request, cleaned=True)
+ try:
+ registry.send(request, cleaned=True)
+ self._invalidate_cache()
+ except RegistryError as err:
+ # if registry error occurs, log the error, and raise it as well
+ logger.error(f"registry error removing client hold: {err}")
+ raise (err)
def _delete_domain(self):
"""This domain should be deleted from the registry
@@ -773,7 +785,9 @@ class Domain(TimeStampedModel, DomainHelper):
administrative_contact.domain = self
administrative_contact.save()
- @transition(field="state", source=State.READY, target=State.ON_HOLD)
+ @transition(
+ field="state", source=[State.READY, State.ON_HOLD], target=State.ON_HOLD
+ )
def place_client_hold(self):
"""place a clienthold on a domain (no longer should resolve)"""
# TODO - ensure all requirements for client hold are made here
@@ -782,7 +796,7 @@ class Domain(TimeStampedModel, DomainHelper):
self._place_client_hold()
# TODO -on the client hold ticket any additional error handling here
- @transition(field="state", source=State.ON_HOLD, target=State.READY)
+ @transition(field="state", source=[State.READY, State.ON_HOLD], target=State.READY)
def revert_client_hold(self):
"""undo a clienthold placed on a domain"""
diff --git a/src/registrar/models/transition_domain.py b/src/registrar/models/transition_domain.py
index a1210a818..203795925 100644
--- a/src/registrar/models/transition_domain.py
+++ b/src/registrar/models/transition_domain.py
@@ -13,8 +13,6 @@ class TransitionDomain(TimeStampedModel):
state of a domain upon transition between registry
providers"""
- StatusChoices = StatusChoices
-
username = models.TextField(
null=False,
blank=False,
diff --git a/src/registrar/templates/domain_detail.html b/src/registrar/templates/domain_detail.html
index 074f7fec3..6a700b393 100644
--- a/src/registrar/templates/domain_detail.html
+++ b/src/registrar/templates/domain_detail.html
@@ -5,6 +5,28 @@
{{ block.super }}
+
+
+
+
+ Status:
+
+ {% if domain.state == domain.State.UNKNOWN or domain.state == domain.State.DNS_NEEDED%}
+ DNS Needed
+ {% else %}
+ {{ domain.state|title }}
+ {% endif %}
+
+
+
+
+
{% url 'domain-nameservers' pk=domain.id as url %}
{% if domain.nameservers|length > 0 %}
{% include "includes/summary_item.html" with title='DNS name servers' value=domain.nameservers list='true' edit_link=url %}
diff --git a/src/registrar/templates/home.html b/src/registrar/templates/home.html
index db3fab886..e86c08c70 100644
--- a/src/registrar/templates/home.html
+++ b/src/registrar/templates/home.html
@@ -33,14 +33,18 @@
{% for domain in domains %}
- {% comment %} ticket 796
- {% if domain.application_status == "approved" or (domain.application does not exist) %} {% endcomment %}
{{ domain.name }}
{{ domain.created_time|date }}
-
{{ domain.application_status|title }}
+
+ {% if domain.state == "unknown" or domain.state == "dns needed"%}
+ DNS Needed
+ {% else %}
+ {{ domain.state|title }}
+ {% endif %}
+