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

Ensure we always pass a Hash to handle_exception, fixes #1134

This commit is contained in:
Mike Perham 2013-08-25 12:59:33 -07:00
parent 4b1069a831
commit 2b9ab89489
3 changed files with 17 additions and 15 deletions

View file

@ -5,6 +5,8 @@
- Fix more race conditions in Web UI actions - Fix more race conditions in Web UI actions
- Don't reset Job enqueued\_at when retrying - Don't reset Job enqueued\_at when retrying
- Timestamp tooltips in the Web UI should use UTC - Timestamp tooltips in the Web UI should use UTC
- Fix invalid usage of handle\_exception causing issues in Airbrake
[#1134]
2.13.1 2.13.1

View file

@ -1,39 +1,39 @@
module Sidekiq module Sidekiq
module ExceptionHandler module ExceptionHandler
def handle_exception(ex, msg) def handle_exception(ex, ctxHash)
Sidekiq.logger.warn msg Sidekiq.logger.warn ctxHash
Sidekiq.logger.warn ex Sidekiq.logger.warn ex
Sidekiq.logger.warn ex.backtrace.join("\n") Sidekiq.logger.warn ex.backtrace.join("\n")
# This list of services is getting a bit ridiculous. # This list of services is getting a bit ridiculous.
# For future error services, please add your own # For future error services, please add your own
# middleware like BugSnag does: # middleware like BugSnag does:
# https://github.com/bugsnag/bugsnag-ruby/blob/master/lib/bugsnag/sidekiq.rb # https://github.com/bugsnag/bugsnag-ruby/blob/master/lib/bugsnag/sidekiq.rb
send_to_airbrake(msg, ex) if defined?(::Airbrake) send_to_airbrake(ctxHash, ex) if defined?(::Airbrake)
send_to_honeybadger(msg, ex) if defined?(::Honeybadger) send_to_honeybadger(ctxHash, ex) if defined?(::Honeybadger)
send_to_exceptional(msg, ex) if defined?(::Exceptional) send_to_exceptional(ctxHash, ex) if defined?(::Exceptional)
send_to_exception_notifier(msg, ex) if defined?(::ExceptionNotifier) send_to_exception_notifier(ctxHash, ex) if defined?(::ExceptionNotifier)
end end
private private
def send_to_airbrake(msg, ex) def send_to_airbrake(hash, ex)
::Airbrake.notify_or_ignore(ex, :parameters => msg) ::Airbrake.notify_or_ignore(ex, :parameters => hash)
end end
def send_to_honeybadger(msg, ex) def send_to_honeybadger(hash, ex)
::Honeybadger.notify_or_ignore(ex, :parameters => msg) ::Honeybadger.notify_or_ignore(ex, :parameters => hash)
end end
def send_to_exceptional(msg, ex) def send_to_exceptional(hash, ex)
if ::Exceptional::Config.should_send_to_api? if ::Exceptional::Config.should_send_to_api?
::Exceptional.context(msg) ::Exceptional.context(hash)
::Exceptional::Remote.error(::Exceptional::ExceptionData.new(ex)) ::Exceptional::Remote.error(::Exceptional::ExceptionData.new(ex))
end end
end end
def send_to_exception_notifier(msg, ex) def send_to_exception_notifier(hash, ex)
::ExceptionNotifier.notify_exception(ex, :data => {:message => msg}) ::ExceptionNotifier.notify_exception(ex, :data => {:message => hash})
end end
end end
end end

View file

@ -116,7 +116,7 @@ module Sidekiq
end end
rescue Exception => e rescue Exception => e
handle_exception(e, "Error calling retries_exhausted") handle_exception(e, { :context => "Error calling retries_exhausted" })
end end
def retry_attempts_from(msg_retry, default) def retry_attempts_from(msg_retry, default)