Skip to content

Downgrade logger.error to logger.warning for server errors#2324

Merged
hiroshinishio merged 1 commit intomainfrom
wes
Feb 24, 2026
Merged

Downgrade logger.error to logger.warning for server errors#2324
hiroshinishio merged 1 commit intomainfrom
wes

Conversation

@hiroshinishio
Copy link
Collaborator

Summary

  • _handle_generic_error in handle_exceptions.py correctly skipped sentry_sdk.capture_exception() for 5xx server errors, but then called logger.error() unconditionally
  • Sentry's auto-enabled LoggingIntegration captures all ERROR-level logs as events, so server errors were still spamming Sentry (e.g. AGENT-26D, AGENT-2TW)
  • Downgraded to logger.warning() for server errors so they're still visible in CloudWatch but no longer create Sentry events

…_generic_error

Sentry's LoggingIntegration auto-captures ERROR-level logs as events,
so logger.error() was sending server errors to Sentry even though
capture_exception() was explicitly skipped for 5xx errors.
@hiroshinishio hiroshinishio self-assigned this Feb 24, 2026
@hiroshinishio hiroshinishio merged commit 1e2939b into main Feb 24, 2026
1 check passed
@hiroshinishio hiroshinishio deleted the wes branch February 24, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant