Skip to content

feat: let the filter sanitize the error message - #184

Open
sean-regents wants to merge 1 commit into
elixir-error-tracker:mainfrom
regents-ai:sanitize-reason
Open

sean-regents wants to merge 1 commit into
elixir-error-tracker:mainfrom
regents-ai:sanitize-reason

Conversation

@sean-regents

Copy link
Copy Markdown

The filter can clean the context before it is saved, but the error message (reason) is saved as it is. Messages can carry user data, such as an email address in a changeset error or a value in a query error, and there is currently no way to clean them.

This adds an optional sanitize_reason/1 callback to ErrorTracker.Filter:

  • When the configured filter implements it, the message goes through it before it is saved, on both the error and the occurrence.
  • An error saved before the callback was added takes the cleaned message at its next occurrence. The conflict update now also sets reason, so the error row always shows the latest saved message.
  • The ignorer still receives the original message, since nothing it sees is saved.
  • The fingerprint never included the message, so grouping is unchanged.
  • Filters without the callback behave exactly as before.

Tests in test/error_tracker/filter_test.exs cover a message saved unchanged without the callback, a message cleaned on both rows, and an older error cleaned when it happens again. The full suite succeeds with DB=sqlite mix test.

The branch is based on v0.9.0. The three changed files are identical on main, so it merges cleanly.

馃 Generated with Claude Code

ErrorTracker.Filter gains an optional sanitize_reason/1 callback. When the
configured filter implements it, the error message is passed through it
before it is saved, on both the error and the occurrence. An error saved
before the callback existed takes the cleaned message at its next
occurrence. The ignorer still receives the original message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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