Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/rocket_pants/controller/rescuable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ module Rescuable
end
},
:bugsnag => lambda { |controller, exception, request|
controller.send(:notify_bugsnag, exception, request: request)
if controller.respond_to?(:notify_bugsnag, true)
controller.send(:notify_bugsnag, exception, request: request)
else
# Bugsnag v6 removed #notify_bugsnag controller method
# Use #notify directly
Bugsnag.notify(exception)
end
}
}

Expand Down
3 changes: 3 additions & 0 deletions spec/rocket_pants/controller/error_handling_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
before :each do
controller_class.use_named_exception_notifier :bugsnag
stub.instance_of(controller_class).notify_bugsnag {}
Bugsnag = Class.new do
define_singleton_method(:notify) { |exception| }
end
end

it 'should send notification when it is the named exception notifier' do
Expand Down