Skip to content
Merged
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
16 changes: 12 additions & 4 deletions src/sentry/api/endpoints/project_rule_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
from sentry.notifications.types import TEST_NOTIFICATION_ID
from sentry.rules.processing.processor import activate_downstream_actions
from sentry.services.eventstore.models import GroupEvent
from sentry.shared_integrations.exceptions import IntegrationFormError
from sentry.shared_integrations.exceptions import (
IntegrationConfigurationError,
IntegrationFormError,
)
from sentry.utils.samples import create_sample_event
from sentry.workflow_engine.endpoints.utils.test_fire_action import test_fire_action
from sentry.workflow_engine.migration_helpers.rule_action import (
Expand All @@ -27,6 +30,8 @@

logger = logging.getLogger(__name__)

REPORTABLE_ERROR_TYPES = (IntegrationFormError, IntegrationConfigurationError)


@region_silo_endpoint
class ProjectRuleActionsEndpoint(ProjectEndpoint):
Expand Down Expand Up @@ -109,7 +114,7 @@

# safe_execute logs these as exceptions, which can result in
# noisy sentry issues, so log with a warning instead.
if isinstance(exc, IntegrationFormError):
if isinstance(exc, REPORTABLE_ERROR_TYPES):
logger.warning(
"%s.test_alert.integration_error", callback_name, extra={"exc": exc}
)
Expand Down Expand Up @@ -177,12 +182,15 @@
action.id = TEST_NOTIFICATION_ID
# Annotate the action with the workflow id
setattr(action, "workflow_id", workflow.id)
except Exception as e:
except REPORTABLE_ERROR_TYPES as e:
action_exceptions.append(str(e))
sentry_sdk.capture_exception(e)
continue
except Exception as e:
error_id = sentry_sdk.capture_exception(e)
action_exceptions.append(f"An unexpected error occurred. Error ID: '{error_id}'")
continue

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

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.

status = None
data = None
Expand Down
Loading