@@ -65,8 +65,8 @@ def get_combined_log_message(email):
65
65
subject = header ["value" ]
66
66
67
67
return (
68
- f"Email with { subject } , from { email ['source ' ]} to "
69
- f"{ email ['destination' ]} "
68
+ f"Email ID { email ['message_id ' ]} with { subject } , "
69
+ f"from { email [ 'source' ] } to { email ['destination' ]} "
70
70
)
71
71
72
72
@@ -138,7 +138,7 @@ def get_cl_court_id(email):
138
138
return map_pacer_to_cl_id (sub_domain )
139
139
140
140
141
- def log_invalid_court_error (response ):
141
+ def log_invalid_court_error (response , message_id ):
142
142
"""Checks if the response indicates an invalid court pk then send a report
143
143
to Sentry.
144
144
"""
@@ -149,7 +149,10 @@ def log_invalid_court_error(response):
149
149
if "Invalid pk" in msg :
150
150
match = re .search (r'Invalid pk "([^"]+)"' , msg )
151
151
if match :
152
- error_message = f"Invalid court pk: { match .group (1 )} "
152
+ error_message = (
153
+ f"Invalid court pk: { match .group (1 )} - "
154
+ f"message_id: { message_id } "
155
+ )
153
156
sentry_sdk .capture_message (error_message , level = "error" )
154
157
break
155
158
@@ -185,7 +188,8 @@ def send_to_court_listener(email, receipt):
185
188
# Gateway Timeout status codes.
186
189
court_listener_response .raise_for_status ()
187
190
188
- log_invalid_court_error (court_listener_response )
191
+ message_id = email .get ("message_id" )
192
+ log_invalid_court_error (court_listener_response , message_id )
189
193
190
194
print (
191
195
f"Got { court_listener_response .status_code = } and content "
0 commit comments