Module: ErrorappNotifier
- Defined in:
- lib/errorapp_notifier.rb,
lib/errorapp_notifier/config.rb,
lib/errorapp_notifier/notify.rb,
lib/errorapp_notifier/railtie.rb,
lib/errorapp_notifier/version.rb,
lib/errorapp_notifier/notifier.rb,
lib/errorapp_notifier/sanitizer.rb,
lib/errorapp_notifier/failure_data.rb,
lib/errorapp_notifier/notifiers/tester.rb,
lib/errorapp_notifier/rack_failure_data.rb,
lib/errorapp_notifier/controller_failure_data.rb,
lib/errorapp_notifier/action_controller_methods.rb
Defined Under Namespace
Modules: ActionControllerMethods, Integration
Classes: Config, ControllerDataExtractor, ControllerFailureData, FailureData, Notifier, Notify, RackFailureData, Railtie, Sanitizer
Constant Summary
collapse
- PROTOCOL_VERSION =
1
- CLIENT_NAME =
'errorapp_notifier-gem'
- ENVIRONMENT_FILTER =
[]
- ENVIRONMENT_WHITELIST =
%w(HOME PATH PWD RUBYOPT GEM_HOME RACK_ENV
RAILS_ENV BUNDLE_GEMFILE BUNDLE_BIN_PATH)
- VERSION =
"0.1.0"
Class Method Summary
collapse
Class Method Details
.clear! ⇒ Object
64
65
66
|
# File 'lib/errorapp_notifier.rb', line 64
def clear!
Thread.current[:notifier_context] = nil
end
|
.configuration ⇒ Object
29
30
31
|
# File 'lib/errorapp_notifier.rb', line 29
def configuration
@configuration ||= ErrorappNotifier::Config.new
end
|
25
26
27
|
# File 'lib/errorapp_notifier.rb', line 25
def configure
yield(configuration)
end
|
.context(hash = {}) ⇒ Object
68
69
70
71
72
|
# File 'lib/errorapp_notifier.rb', line 68
def context(hash = {})
Thread.current[:notifier_context] ||= {}
Thread.current[:notifier_context].merge!(hash)
self
end
|
.logger ⇒ Object
33
34
35
|
# File 'lib/errorapp_notifier.rb', line 33
def logger
configuration.logger
end
|
.notify(exception, name = nil) ⇒ Object
37
38
39
|
# File 'lib/errorapp_notifier.rb', line 37
def notify(exception, name=nil)
ErrorappNotifier::Notify.notify(exception, name)
end
|
.rescue(name = nil, context = nil, &block) ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/errorapp_notifier.rb', line 41
def rescue(name=nil, context=nil, &block)
begin
context(context) unless context.nil?
block.call
rescue Exception => e
ErrorappNotifier::Notify.notify(e, name)
ensure
clear!
end
end
|
.rescue_and_reraise(name = nil, context = nil, &block) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/errorapp_notifier.rb', line 52
def rescue_and_reraise(name=nil, context=nil, &block)
begin
context(context) unless context.nil?
block.call
rescue Exception => e
ErrorappNotifier::Notify.notify(e, name)
raise(e)
ensure
clear!
end
end
|