Skip to content
Browse files

add sanity to rescue_action_in_public_without_airbrake call

  • Loading branch information...
1 parent fd87786 commit 091dfdd2e0abb7699aea6a15ffa43e1c7b2507a3 @shime shime committed May 21, 2012
Showing with 8 additions and 18 deletions.
  1. +6 −4 TESTING.md
  2. +2 −14 lib/airbrake/rails/middleware/exceptions_catcher.rb
View
10 TESTING.md
@@ -3,23 +3,25 @@ Running the suite
Since the notifier must run on many versions of Rails, running its test suite is slightly different than you may be used to.
-First execute the following command:
+You should start by trusting the .rvmrc file. We come in peace.
+
+Then execute the following command:
rake vendor_test_gems
# NOT: bundle exec rake vendor_test_gems
-This command will download the various versions of Rails that the notifier must be tested against.
+This command will download the various versions of Rails and other gems that the notifier must be tested against.
Then, to start the suite, run
rake
+ # NOT: bundle exec rake
-Note: do NOT use 'bundle exec rake'.
For Maintainers
================
-When developing the Airbrake Notifier, be sure to use the integration test against an existing project on staging before pushing to master.
+When developing the Airbrake gem, be sure to use the integration test against an existing project on staging before pushing to master.
./script/integration_test.rb <test project's api key> <staging server hostname>
View
16 lib/airbrake/rails/middleware/exceptions_catcher.rb
@@ -6,15 +6,6 @@ def self.included(base)
base.send(:alias_method_chain,:render_exception,:airbrake)
end
- def define_proxy_method(klass)
- klass.class_eval do
- def after_airbrake_hook
- exception = request.env.delete('fake_exception')
- rescue_action_in_public_without_airbrake(exception)
- end
- end
- end
-
def skip_user_agent?(env)
user_agent = env["HTTP_USER_AGENT"]
::Airbrake.configuration.ignore_user_agent.flatten.any? { |ua| ua === user_agent }
@@ -26,12 +17,9 @@ def render_exception_with_airbrake(env,exception)
controller = env['action_controller.instance']
env['airbrake.error_id'] = Airbrake.notify_or_ignore(exception, controller.airbrake_request_data) unless skip_user_agent?(env)
if defined?(controller.rescue_action_in_public_without_airbrake)
- env['fake_exception'] = exception
- define_proxy_method(controller.class)
- controller.class.action(:after_airbrake_hook).call(env)
- else
- render_exception_without_airbrake(env,exception)
+ controller.rescue_action_in_public_without_airbrake(exception)
end
+ render_exception_without_airbrake(env,exception)
end
end
end

0 comments on commit 091dfdd

Please sign in to comment.
Something went wrong with that request. Please try again.