lib/job_dispatch/worker/item.rb in job_dispatch-0.0.1 vs lib/job_dispatch/worker/item.rb in job_dispatch-0.0.2
- old
+ new
@@ -28,10 +28,14 @@
Thread.current["JobDispatch::Worker.job_id"] = job_id
@klass = target.constantize
@result = @klass.__send__(method.to_sym, *params)
@status = :success
rescue StandardError => ex
- @result = ex
+ @result = {
+ class: ex.class.to_s,
+ message: ex.to_s,
+ backtrace: ex.backtrace,
+ }
@status = :error
ensure
Thread.current["JobDispatch::Worker.job_id"] = nil
JobDispatch.logger.info "Worker completed job #{job_id}: #{target}.#{method}, status: #{@status}"
end