Send errors from rails clockwork gem to airbrake?

235 Views Asked by At

What is the best way to send errors from clockwork to Airbrake?

2

There are 2 best solutions below

0
spickermann On BEST ANSWER

Just add the following to your clockwork definition:

module Clockwork
  error_handler do |error|
    Airbrake.notify_or_ignore(error)
  end

  # existing configuration
end

See: Clockwork Docs about error_handler

0
Leo Correa On

The airbrake library has an API to notify their service directly without raising an exception. Their GitHub has a ton of documentation on this.

Airbrake Ruby

You can do something like this:

Airbrake.notify("Opps!")