2012-07-31 11:43:09 -04:00
|
|
|
module Sidekiq
|
|
|
|
module ExceptionHandler
|
|
|
|
|
2012-08-02 23:46:06 -04:00
|
|
|
def handle_exception(ex, msg)
|
|
|
|
Sidekiq.logger.warn msg
|
|
|
|
Sidekiq.logger.warn ex
|
|
|
|
Sidekiq.logger.warn ex.backtrace.join("\n")
|
2012-07-31 11:43:09 -04:00
|
|
|
send_to_airbrake(msg, ex) if defined?(::Airbrake)
|
2012-10-26 23:33:54 -04:00
|
|
|
send_to_honeybadger(msg, ex) if defined?(::Honeybadger)
|
2012-07-31 11:43:09 -04:00
|
|
|
send_to_exceptional(msg, ex) if defined?(::Exceptional)
|
|
|
|
send_to_exception_notifier(msg, ex) if defined?(::ExceptionNotifier)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def send_to_airbrake(msg, ex)
|
2012-09-06 13:49:58 -04:00
|
|
|
::Airbrake.notify_or_ignore(ex, :parameters => msg)
|
2012-07-31 11:43:09 -04:00
|
|
|
end
|
|
|
|
|
2012-10-26 23:33:54 -04:00
|
|
|
def send_to_honeybadger(msg, ex)
|
|
|
|
::Honeybadger.notify_or_ignore(ex, :parameters => msg)
|
|
|
|
end
|
|
|
|
|
2012-07-31 11:43:09 -04:00
|
|
|
def send_to_exceptional(msg, ex)
|
|
|
|
if ::Exceptional::Config.should_send_to_api?
|
|
|
|
::Exceptional.context(msg)
|
|
|
|
::Exceptional::Remote.error(::Exceptional::ExceptionData.new(ex))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def send_to_exception_notifier(msg, ex)
|
2012-08-15 17:14:02 -04:00
|
|
|
::ExceptionNotifier::Notifier.background_exception_notification(ex, :data => { :message => msg }).deliver
|
2012-07-31 11:43:09 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|