-
Notifications
You must be signed in to change notification settings - Fork 17
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
More information in the context of each exception #37
Comments
P.S.: for the second question, if you feel it is indeed outside of the scope of this gem to bring the context inside the engine, would you mind if at least we add a how-to in the README orienting how people can add this more obvious information like the params and args? |
P.S.2: In the case of the Jobs, if #inspect is adopted to save the context, the arguments will already be there, and there is no actual need to add that before_perform I suggested initially. |
I'm open to the PR, yes. |
I dropped the The PR in Honeybadger that added this code explains more context: honeybadger-io/honeybadger-ruby#239 At a more basic level, Maybe the simplest path forward is to have the hook added by the gem to jobs pushed ActiveJob's serialized data, like this comment from the Sentry repo: getsentry/sentry-ruby#1643 (comment) class ApplicationJob < ActiveJob::Base
before_perform do |job|
Rails.error.set_context(arguments: job.serialize["arguments"])
end
end |
@everton: Would you like to make the PR to patch controllers and jobs to automatically add context? |
In order to understand some errors, it is better to have the context that generated them (the params in a controller action, the arguments sent to a job, etc). The code line and stack trace are great, but you need to go after all your registers to understand which record generated that bug, etc.
I totally understand that you are trying to keep the gem as simple as possible, and as is stated in the README:
I added this information using using the Rails.error.set_context with codes like:
and
It worked for the controllers, but for the jobs, active record objects were saved in the context as just a String with their class name, which makes them useless.
I saw the "sanitizer" code, and I can see you chose to create this string instead of, for example, calling the Object#inspect. I have two separate question for this issue:
The text was updated successfully, but these errors were encountered: