Skip to content

Commit 104d087

Browse files
fix(eco): Report integration config errors to users when testing actions (#100849)
1 parent ac4b6c6 commit 104d087

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/sentry/api/endpoints/project_rule_actions.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
from sentry.notifications.types import TEST_NOTIFICATION_ID
1717
from sentry.rules.processing.processor import activate_downstream_actions
1818
from sentry.services.eventstore.models import GroupEvent
19-
from sentry.shared_integrations.exceptions import IntegrationFormError
19+
from sentry.shared_integrations.exceptions import (
20+
IntegrationConfigurationError,
21+
IntegrationFormError,
22+
)
2023
from sentry.utils.samples import create_sample_event
2124
from sentry.workflow_engine.endpoints.utils.test_fire_action import test_fire_action
2225
from sentry.workflow_engine.migration_helpers.rule_action import (
@@ -27,6 +30,8 @@
2730

2831
logger = logging.getLogger(__name__)
2932

33+
REPORTABLE_ERROR_TYPES = (IntegrationFormError, IntegrationConfigurationError)
34+
3035

3136
@region_silo_endpoint
3237
class ProjectRuleActionsEndpoint(ProjectEndpoint):
@@ -109,7 +114,7 @@ def execute_future_on_test_event(
109114

110115
# safe_execute logs these as exceptions, which can result in
111116
# noisy sentry issues, so log with a warning instead.
112-
if isinstance(exc, IntegrationFormError):
117+
if isinstance(exc, REPORTABLE_ERROR_TYPES):
113118
logger.warning(
114119
"%s.test_alert.integration_error", callback_name, extra={"exc": exc}
115120
)
@@ -177,9 +182,12 @@ def execute_future_on_test_event_workflow_engine(
177182
action.id = TEST_NOTIFICATION_ID
178183
# Annotate the action with the workflow id
179184
setattr(action, "workflow_id", workflow.id)
180-
except Exception as e:
185+
except REPORTABLE_ERROR_TYPES as e:
181186
action_exceptions.append(str(e))
182-
sentry_sdk.capture_exception(e)
187+
continue
188+
except Exception as e:
189+
error_id = sentry_sdk.capture_exception(e)
190+
action_exceptions.append(f"An unexpected error occurred. Error ID: '{error_id}'")
183191
continue
184192

185193
action_exceptions.extend(test_fire_action(action, event_data, detector))

0 commit comments

Comments
 (0)