File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
src/sentry/api/serializers/models Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -352,7 +352,19 @@ def get_attrs(
352352 # This is a metric alert rule
353353 serialized_alert_rule = serialized_alert_rule_map_by_id [item_id ]
354354 if "latestIncident" in self .expand :
355- serialized_alert_rule ["latestIncident" ] = incident_map .get (item .incident_id ) # type: ignore[attr-defined]
355+ # Eg. we _have_ an incident
356+ try :
357+ serialized_alert_rule ["latestIncident" ] = incident_map .get (item .incident_id )
358+ except AttributeError as e :
359+ logger .exception (
360+ "incident serialization error" ,
361+ extra = {
362+ "exception" : e ,
363+ "alert_rule_id" : item_id ,
364+ "is_metric_alert" : isinstance (item , AlertRule ),
365+ "is_issue_alert" : isinstance (item , Rule ),
366+ },
367+ )
356368 results [item ] = serialized_alert_rule
357369 elif item_id in serialized_issue_rule_map_by_id :
358370 # This is an issue alert rule
You can’t perform that action at this time.
0 commit comments