Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ietf/ipr/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,9 @@ def test_ingest_response_email(self, mock_process_response_email):

mock_process_response_email.side_effect = None
mock_process_response_email.return_value = None # rejected message
ingest_response_email(message) # should _not_ send an exception email on a clean rejection
with self.assertRaises(EmailIngestionError) as context:
ingest_response_email(message)
self.assertIsNone(context.exception.as_emailmessage()) # should not send an email on a clean rejection
self.assertTrue(mock_process_response_email.called)
self.assertEqual(mock_process_response_email.call_args, mock.call(message))
mock_process_response_email.reset_mock()
Expand Down
9 changes: 8 additions & 1 deletion ietf/ipr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ def generate_draft_recursive_txt():
def ingest_response_email(message: bytes):
from ietf.api.views import EmailIngestionError # avoid circular import
try:
process_response_email(message)
result = process_response_email(message)
except Exception as err:
# Message was rejected due to an unhandled exception. This is likely something
# the admins need to address, so send them a copy of the email.
raise EmailIngestionError(
"Datatracker IPR email ingestion error",
email_body=dedent("""\
Expand All @@ -104,3 +106,8 @@ def ingest_response_email(message: bytes):
email_original_message=message,
email_attach_traceback=True,
) from err

if result is None:
# Message was rejected due to some problem the sender can fix, so bounce but don't send
# an email to the admins
raise EmailIngestionError("IPR response rejected", email_body=None)