lib/raven/sidekiq.rb in sentry-raven-0.7.1 vs lib/raven/sidekiq.rb in sentry-raven-0.8.0
- old
+ new
@@ -1,18 +1,23 @@
module Raven
class Sidekiq
def call(worker, msg, queue)
- begin
- yield
- rescue => ex
- Raven.capture_exception(ex, :extra => {:sidekiq => msg})
- raise
- end
+ yield
+ rescue => ex
+ Raven.capture_exception(ex, :extra => { :sidekiq => msg })
+ raise
end
end
end
-::Sidekiq.configure_server do |config|
- config.server_middleware do |chain|
- chain.add ::Raven::Sidekiq
+if Sidekiq::VERSION < '3'
+ # old behavior
+ ::Sidekiq.configure_server do |config|
+ config.server_middleware do |chain|
+ chain.add ::Raven::Sidekiq
+ end
end
-end
\ No newline at end of file
+else
+ Sidekiq.configure_server do |config|
+ config.error_handlers << Proc.new {|ex,context| Raven.capture_exception(ex, context) }
+ end
+end