1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
mperham--sidekiq/lib/sidekiq/exception_handler.rb

36 lines
1 KiB
Ruby
Raw Normal View History

module Sidekiq
module ExceptionHandler
def handle_exception(ex, msg)
Sidekiq.logger.warn msg
Sidekiq.logger.warn ex
Sidekiq.logger.warn ex.backtrace.join("\n")
send_to_airbrake(msg, ex) if defined?(::Airbrake)
2012-10-26 23:33:54 -04:00
send_to_honeybadger(msg, ex) if defined?(::Honeybadger)
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)
end
2012-10-26 23:33:54 -04:00
def send_to_honeybadger(msg, ex)
::Honeybadger.notify_or_ignore(ex, :parameters => msg)
end
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)
::ExceptionNotifier::Notifier.background_exception_notification(ex, :data => { :message => msg }).deliver
end
end
end