Open mikeatlas opened 10 years ago
This is because I'm getting json nil
on line 27, which results in json.delete call failing...
json = job.as_json["job"]
hello @qiushihe, are you still maintaining this gem?
Hi, yes I am maintaining this gem.
What is the actual exception that got rescued on line 17 (line 18 logs it as "Raven logging failed: #{e.class.name}: #{e.message}"
)?
Also, I am using DelayedJob 4.0.1 in a production environment and it's working fine for me. Although I'm using Rails 4.1. Could you try and see what the output is for this:
Delayed::Job.last.as_json
... it's something like this for me:
{"job"=>{"id"=>40299504, "priority"=>0, "attempts"=>0, "handler"=>"...", "last_error"=>nil, ... }}
get_job_json(job)
is returning nil
(I don't know why?) but then line 30 json.delete(attribute)
throws an exception itself (can't call delete
on nil
), and the call to Raven thus never happens.
Line 30, json.delete(...)
throws the exception, because json
is nil
. And that's because job.as_json["job"]
is nil
for some reason.
If you see what I've posted about my output, job.as_json
should return a job
-namespaced hash for the job. And for some reason, it's not doing that for you.
That's why I wanted you to try and see what the output of Delayed::Job.last.as_json
is. You can run that in a rails console.
I'm hitting this when Raven logging itself fails and then flushing the logger fails:
https://github.com/qiushihe/delayed-plugins-raven/blob/master/lib/delayed-plugins-raven.rb#L19
undefined method
flush' for #rescue in error' /gems/delayed-plugins-raven-1.0.5/lib/delayed-plugins-raven.rb:12:in
error'`Any thoughts? Rails 4.0.5, delayed_job 4.0.1