Module: HoptoadNotifier::Catcher
- Included in:
- Sender
- Defined in:
- lib/hoptoad_notifier.rb
Overview
Include this module in Controllers in which you want to be notified of errors.
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#logger ⇒ Object
Returns the default logger or a logger that prints to STDOUT.
-
#notify_hoptoad(hash_or_exception) ⇒ Object
This method should be used for sending manual notifications while you are still inside the controller.
-
#rescue_action_in_public_with_hoptoad(exception) ⇒ Object
Overrides the rescue_action method in ActionController::Base, but does not inhibit any custom processing that is defined with Rails 2’s exception helpers.
Class Method Details
.included(base) ⇒ Object
:nodoc:
238 239 240 241 242 243 |
# File 'lib/hoptoad_notifier.rb', line 238 def self.included(base) #:nodoc: if base.instance_methods.include? 'rescue_action_in_public' and !base.instance_methods.include? 'rescue_action_in_public_without_hoptoad' base.send(:alias_method, :rescue_action_in_public_without_hoptoad, :rescue_action_in_public) base.send(:alias_method, :rescue_action_in_public, :rescue_action_in_public_with_hoptoad) end end |
Instance Method Details
#logger ⇒ Object
Returns the default logger or a logger that prints to STDOUT. Necessary for manual notifications outside of controllers.
264 265 266 267 268 |
# File 'lib/hoptoad_notifier.rb', line 264 def logger ActiveRecord::Base.logger rescue @logger ||= Logger.new(STDERR) end |
#notify_hoptoad(hash_or_exception) ⇒ Object
This method should be used for sending manual notifications while you are still inside the controller. Otherwise it works like HoptoadNotifier.notify.
254 255 256 257 258 259 260 |
# File 'lib/hoptoad_notifier.rb', line 254 def notify_hoptoad hash_or_exception if public_environment? notice = normalize_notice(hash_or_exception) notice = clean_notice(notice) send_to_hoptoad(:notice => notice) end end |
#rescue_action_in_public_with_hoptoad(exception) ⇒ Object
Overrides the rescue_action method in ActionController::Base, but does not inhibit any custom processing that is defined with Rails 2’s exception helpers.
247 248 249 250 |
# File 'lib/hoptoad_notifier.rb', line 247 def rescue_action_in_public_with_hoptoad exception notify_hoptoad(exception) unless ignore?(exception) || ignore_user_agent? rescue_action_in_public_without_hoptoad(exception) end |