Class: HipchatExceptionNotifier
- Inherits:
-
Object
- Object
- HipchatExceptionNotifier
- Defined in:
- lib/hipchat_exception_notifier.rb,
lib/hipchat_exception_notifier/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ HipchatExceptionNotifier
constructor
A new instance of HipchatExceptionNotifier.
Constructor Details
#initialize(app, options = {}) ⇒ HipchatExceptionNotifier
Returns a new instance of HipchatExceptionNotifier.
13 14 15 16 |
# File 'lib/hipchat_exception_notifier.rb', line 13 def initialize(app, = {}) @app, @options = app, @options[:ignore_exceptions] ||= self.class.default_ignore_exceptions end |
Class Method Details
.default_ignore_exceptions ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/hipchat_exception_notifier.rb', line 5 def self.default_ignore_exceptions [].tap do |exceptions| exceptions << ::ActiveRecord::RecordNotFound if defined? ::ActiveRecord::RecordNotFound exceptions << ::AbstractController::ActionNotFound if defined? ::AbstractController::ActionNotFound exceptions << ::ActionController::RoutingError if defined? ::ActionController::RoutingError end end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/hipchat_exception_notifier.rb', line 18 def call(env) @app.call(env) rescue Exception => ex unless Array.wrap(@options[:ignore_exceptions]).include?(ex.class) deliver_exception(ex) end raise ex end |