If you’ve set up Errbit/Airbrake and you use Sidekiq, by default you would expect, that Errbit tracks things that happen in Sidekiq workers as well. Unfortunately it doesn’t.

In order to make Sidekiq retry failed jobs in needs to catch and handle exceptions on its own. And that’s the reason why you need a bit of “magic” to make it work with Errbit. You need to add an custom error handler that will notify Errbit app about errors that occured in Sidekiq workers.

To do so, just create an initializer like this:

# Errbit error catching for Sidekiq workers
Sidekiq.configure_server do |config|
  config.error_handlers << Proc.new { |ex,ctx_hash| Airbrake.notify_or_ignore(ex, ctx_hash) }

And that’s all!