gearman-ruby icon indicating copy to clipboard operation
gearman-ruby copied to clipboard

How to print worker exceptions on worker stdout/stderr

Open spiffytech opened this issue 10 years ago • 1 comments

My workers are raising exceptions and silently failing to finish. How can I have worker exceptions printed to stdout/stderr of the console running the worker?

spiffytech avatar Oct 24 '14 15:10 spiffytech

@spiffytech

You should be able to do something like this:

class MyWorker < Gearman::Worker
  on_work_exception do
    # error handling logic
  end
end

It occurs to me that it's not super useful that the exception isn't handed to the block as an argument. That would be an awesome contribution, but you may be able to get by in the meantime with $!.

bcobb avatar Oct 24 '14 16:10 bcobb