Skip to content

feat: add classifyError callback for error severity control#8

Open
benminer wants to merge 2 commits intomainfrom
feature/classify-error-hook
Open

feat: add classifyError callback for error severity control#8
benminer wants to merge 2 commits intomainfrom
feature/classify-error-hook

Conversation

@benminer
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a classifyError optional callback to ObservabilityConfig that returns 'drop', 'warning', or undefined
  • In beforeSend, 'drop' suppresses the error (same as shouldDropError), 'warning' downgrades the event level so it won't trigger high-severity alerts, and undefined leaves it unchanged
  • Keeps shouldDropError for backwards compatibility — it takes precedence when both are provided
  • Bumps version to 2.1.0

Test plan

  • Verify classifyError returning 'drop' suppresses errors
  • Verify classifyError returning 'warning' sets event.level = 'warning'
  • Verify classifyError returning undefined passes errors through unchanged
  • Verify existing shouldDropError behavior is unaffected

Allow consumers to downgrade errors to warning level instead of only
dropping them, so transport errors stay visible in Sentry without
triggering high-severity alerts. Bump to v2.1.0.
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