Skip to content

Commit

Permalink
Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
snmaynard committed Jun 21, 2018
1 parent 475df87 commit 3e43a40
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions lib/bugsnag/integrations/sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ module Bugsnag
# Extracts and attaches Sidekiq job and queue information to an error report
class Sidekiq

FRAMEWORK_ATTRIBUTES = {
:framework => "Sidekiq"
} unless const_defined?(:FRAMEWORK_ATTRIBUTES)
unless const_defined?(:FRAMEWORK_ATTRIBUTES)
FRAMEWORK_ATTRIBUTES = {
:framework => "Sidekiq"
}
end

def initialize
Bugsnag.configuration.internal_middleware.use(Bugsnag::Middleware::Sidekiq)
Expand All @@ -29,14 +31,13 @@ def call(worker, msg, queue)
end

def self.notify(exception)
unless [Interrupt, SystemExit, SignalException].include? exception.class
Bugsnag.notify(exception, true) do |report|
report.severity = "error"
report.severity_reason = {
:type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE,
:attributes => FRAMEWORK_ATTRIBUTES
}
end
return unless [Interrupt, SystemExit, SignalException].include? exception.class
Bugsnag.notify(exception, true) do |report|
report.severity = "error"
report.severity_reason = {
:type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE,
:attributes => FRAMEWORK_ATTRIBUTES
}
end
end

Expand All @@ -46,7 +47,7 @@ def self.sidekiq_supports_error_handlers

def self.configure_server(server)
if Bugsnag::Sidekiq.sidekiq_supports_error_handlers
server.error_handlers << proc do |ex, context|
server.error_handlers << proc do |ex, _context|
Bugsnag::Sidekiq.notify(ex)
end
end
Expand Down

0 comments on commit 3e43a40

Please sign in to comment.