Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use after_change for context changes #651

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

roelbondoc
Copy link
Member

When an application uses Rails.error.set_context to set context, the gem does not see this data until an error is reported. This change uses the ActiveSupport::ExecutionContext.after_change callback so that we can always keep track of context changes. This ensures we can report errors with the proper context outside of Rails error report handling.

Closes: #648

Specifically, this will also fix the issue with the way we report errors for ActiveJob.

Before submitting a pull request, please make sure the following is done:

  1. If you've fixed a bug or added code that should be tested, add tests!
  2. Run rake spec in the repository root.
  3. Use a pull request title that conforms to conventional commits.

When an application uses `Rails.error.set_context` to set context, the
gem does not see this data until an error is reported. This change uses
the `ActiveSupport::ExecutionContext.after_change` callback so that we
can always keep track of context changes. This ensures we can report
errors with the proper context outside of Rails error report handling.
@roelbondoc roelbondoc requested a review from a team November 27, 2024 15:31
@roelbondoc roelbondoc merged commit 2cfc766 into master Nov 27, 2024
59 checks passed
@roelbondoc roelbondoc deleted the use-execution-context-callbacks branch November 27, 2024 16:06
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.

Honeybadger Rack middleware ignores Rails error context when creating notice for unhandled error
2 participants