Skip to content
Snippets Groups Projects
Commit d1c28815 authored by Samuel Esposito's avatar Samuel Esposito
Browse files

pass request data to airbrake

parent d9c6b8da
No related branches found
Tags v0.1.15
No related merge requests found
## 0.1.13 / 2014-11-12
* Add support for reporting request data to Airbrake
## 0.1.12 / 2014-11-10
* Added roqua/core_ext/active_interaction/filters/date_time_as_unix_extension that allows date_times attributes to be set by a unix timestamp.
......
PATH
remote: .
specs:
roqua-support (0.1.12)
roqua-support (0.1.13)
activesupport (>= 3.2, < 5.0)
GEM
......
module Roqua
module Support
VERSION = '0.1.12'
VERSION = '0.1.13'
end
end
......@@ -11,6 +11,7 @@ module Roqua
def self.report(exception, extra_params = {})
return if const_defined?(:Rails) and Rails.env.test?
controller = extra_params.delete :controller
parameters = extra_parameters.merge(extra_params)
# Notify Roqua logging
......@@ -24,6 +25,7 @@ module Roqua
# Notify Airbrake
if const_defined?(:Airbrake)
parameters = parameters.merge controller.airbrake_request_data if controller
Airbrake.notify_or_ignore(exception, parameters: parameters)
end
......
......@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
gem.license = "MIT"
gem.authors = ["Marten Veldthuis"]
gem.email = "marten@roqua.nl"
gem.homepage = "https://github.com/roqua/healthy"
gem.homepage = "https://github.com/roqua/roqua-support"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
......
......@@ -26,10 +26,21 @@ describe 'Error reporting' do
Roqua::Support::Errors.report exception
end
it 'sends notifications to airbrake' do
stub_const("Airbrake", double("Airbrake", is_ignored_exception?: false))
Airbrake.should_receive(:notify_or_ignore).with(exception, parameters: {})
Roqua::Support::Errors.report exception
context 'when Airbrake is defined' do
before do
stub_const('Airbrake', double('Airbrake', is_ignored_exception?: false))
end
it 'sends notifications to airbrake' do
Airbrake.should_receive(:notify_or_ignore).with(exception, parameters: {})
Roqua::Support::Errors.report exception
end
it 'adds request data when a controller is passed in' do
controller = double(airbrake_request_data: {request: 'data'})
Airbrake.should_receive(:notify_or_ignore).with(exception, parameters: {request: 'data'})
Roqua::Support::Errors.report exception, controller: controller
end
end
context 'when Appsignal is loaded' do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment