Module: ErrorNotifier
- Defined in:
- lib/error_notifier.rb,
lib/error_notifier/rack.rb,
lib/error_notifier/configuration.rb
Defined Under Namespace
Classes: Configuration, Rack
Constant Summary
collapse
- Version =
'0.0.5'
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
11
12
13
|
# File 'lib/error_notifier.rb', line 11
def configuration
@configuration
end
|
Class Method Details
17
18
19
|
# File 'lib/error_notifier.rb', line 17
def configure
yield(configuration)
end
|
.send(exception, data = {}) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/error_notifier.rb', line 21
def send(exception, data = {})
exception = unwrap(exception)
data[:message] = exception.inspect
data[:stack] = exception.backtrace.join('\n')
data[:site] = @configuration.site
begin
RestClient::Request.execute(
:method => :post,
:url => @configuration.url,
:payload => data.to_json,
:headers => {:content_type => :json, :accept => :json},
:open_timeout => @configuration.open_timeout,
:timeout => @configuration.timeout
)
rescue
nil
end
end
|
.unwrap(exception) ⇒ Object
40
41
42
43
44
|
# File 'lib/error_notifier.rb', line 40
def unwrap(exception)
return exception.original_exception if exception.respond_to?(:original_exception)
return exception.continued_exception if exception.respond_to?(:continued_exception)
exception
end
|