From de82da6e78b576abb14d4d4f35cf4eaa5c672aaf Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:25:14 -0700 Subject: [PATCH] Add last resort --- src/registrar/views/domain.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/registrar/views/domain.py b/src/registrar/views/domain.py index c4e0336f4..5f21a7150 100644 --- a/src/registrar/views/domain.py +++ b/src/registrar/views/domain.py @@ -666,12 +666,17 @@ class DomainAddUserView(DomainFormBaseView): # want to fix this upstream where it is happening. raise ValueError("Can't send email. The given DomainInformation object has no requestor or creator.") + # Attempt to grab the first and last names. As a last resort, just use the email. if first and last: full_name = f"{first} {last}" + elif requester.email is not None and requester.email.strip() != "": + full_name = requester.email + elif domainInfo.creator.email is not None and domainInfo.creator.email.strip() != "": + full_name = domainInfo.creator.email else: # This edgecase would be unusual if encountered. We don't want to handle this here. Rather, we would # want to fix this upstream where it is happening. - raise ValueError("Can't send email. First and last names are none.") + raise ValueError("Can't send email. First and last names, as well as the email, are none.") try: send_templated_email(