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
- Don't reset Job enqueued\_at when retrying
- Timestamp tooltips in the Web UI should use UTC
- Fix invalid usage of handle\_exception causing issues in Airbrake
[#1134]
2.13.1

View file

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

View file

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