Skip to content

Commit f17e2be

Browse files
committed
Merge pull request #454 from getsentry/last-error
Handle nil last_error in delayed_job (fixes GH-453)
2 parents 704b3b8 + b70fcd3 commit f17e2be

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/raven/integrations/delayed_job.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ class Raven < ::Delayed::Plugin
1616
:id => job.id,
1717
:priority => job.priority,
1818
:attempts => job.attempts,
19-
# handlers are YAML objects in strings, we definitely can't
20-
# report all of that or the event will get truncated randomly
21-
:handler => job.handler[0...100],
22-
:last_error => job.last_error[0...100],
2319
:run_at => job.run_at,
2420
:locked_at => job.locked_at,
2521
:locked_by => job.locked_by,
2622
:queue => job.queue,
2723
:created_at => job.created_at
2824
}
2925
}
26+
# last_error can be nil
27+
extra[:last_error] = job.last_error[0...100] if job.last_error
28+
# handlers are YAML objects in strings, we definitely can't
29+
# report all of that or the event will get truncated randomly
30+
extra[:handler] = job.handler[0...100] if job.handler
31+
3032
if job.respond_to?('payload_object') && job.payload_object.respond_to?('job_data')
3133
extra[:active_job] = job.payload_object.job_data
3234
end

0 commit comments

Comments
 (0)