Class: ExceptionNotifier
- Inherits:
-
Object
show all
- Defined in:
- lib/exception_notifier.rb,
lib/exception_notifier/notifier.rb,
lib/exception_notifier/campfire_notifier.rb
Defined Under Namespace
Classes: CampfireNotifier, Notifier
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ExceptionNotifier.
Class Method Details
.default_ignore_crawlers ⇒ Object
15
16
17
|
# File 'lib/exception_notifier.rb', line 15
def self.default_ignore_crawlers
[]
end
|
.default_ignore_exceptions ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/exception_notifier.rb', line 7
def self.default_ignore_exceptions
[].tap do |exceptions|
exceptions << 'ActiveRecord::RecordNotFound'
exceptions << 'AbstractController::ActionNotFound'
exceptions << 'ActionController::RoutingError'
end
end
|
Instance Method Details
#call(env) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/exception_notifier.rb', line 40
def call(env)
@app.call(env)
rescue Exception => exception
options = (env['exception_notifier.options'] ||= Notifier.default_options)
options.reverse_merge!(@options)
unless ignored_exception(options[:ignore_exceptions], exception) ||
from_crawler(options[:ignore_crawlers], env['HTTP_USER_AGENT']) ||
conditionally_ignored(options[:ignore_if], env, exception)
Notifier.exception_notification(env, exception).deliver
@campfire.exception_notification(exception)
env['exception_notifier.delivered'] = true
end
raise exception
end
|