Permalink
Browse files

Using ActionController::Rescue#rescue_action_without_handler instead …

…of rescue_action, being more strict about when it gets included
  • Loading branch information...
1 parent a7cee46 commit 4885eb8b23c8b6fbb7a9526629c0ba72d4b45351 @winton committed Dec 4, 2009
Showing with 17 additions and 12 deletions.
  1. +6 −5 lib/rack/lilypad.rb
  2. +11 −7 lib/rack/lilypad/rails.rb
View
@@ -34,6 +34,10 @@ class <<self
def notify(e)
@@hoptoad.post(e)
end
+
+ def production?
+ %w(staging production).include?(ENV['RACK_ENV'])
+ end
end
class Hoptoad
@@ -65,7 +69,7 @@ def log(*msg)
end
def post(exception, env=nil)
- return unless production?
+ return unless Lilypad.production?
uri = URI.parse("http://hoptoadapp.com:80/notifier_api/v2/notices")
Net::HTTP.start(uri.host, uri.port) do |http|
headers = {
@@ -88,10 +92,6 @@ def post(exception, env=nil)
end
end
- def production?
- %w(staging production).include?(ENV['RACK_ENV'])
- end
-
def xml(exception, env)
environment = filter(ENV.to_hash.merge(env || {}))
if env
@@ -148,6 +148,7 @@ def xml(exception, env)
end
class <<self
+
def last_request
@@last_request
end
View
@@ -6,15 +6,19 @@ module Rails
def self.included(base)
ENV['RACK_ENV'] = ENV['RAILS_ENV']
+ base.send(:include, LilypadMethods) if Lilypad.production?
end
- private
-
- def rescue_action(exception)
- super
- request.env['rack.lilypad.component'] = params[:controller]
- request.env['rack.lilypad.action'] = params[:action]
- raise exception
+ module LilypadMethods
+
+ private
+
+ def rescue_action_without_handler(exception)
+ super
+ request.env['rack.lilypad.component'] = params[:controller]
+ request.env['rack.lilypad.action'] = params[:action]
+ raise exception
+ end
end
end
end

0 comments on commit 4885eb8

Please sign in to comment.