Class: ErrorappNotifier::FailureData
- Inherits:
-
Object
- Object
- ErrorappNotifier::FailureData
show all
- Defined in:
- lib/errorapp_notifier/failure_data.rb
Instance Method Summary
collapse
Constructor Details
#initialize(exception, name = nil) ⇒ FailureData
Returns a new instance of FailureData.
8
9
10
11
|
# File 'lib/errorapp_notifier/failure_data.rb', line 8
def initialize(exception, name = nil)
@exception = exception
@name = name
end
|
Instance Method Details
#to_json ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/errorapp_notifier/failure_data.rb', line 25
def to_json
begin
to_hash.to_json
rescue NoMethodError
begin
require 'json'
return to_hash.to_json
rescue StandardError => e
ErrorappNotifier.logger.error(e.message)
ErrorappNotifier.logger.error(e.backtrace)
raise StandardError.new("You need a json gem/library installed to send errors to ErrorApp (Object.to_json not defined). \nInstall json_pure, yajl-ruby, json-jruby, or the c-based json gem")
end
end
end
|
#uniq_key ⇒ Object
40
41
42
43
|
# File 'lib/errorapp_notifier/failure_data.rb', line 40
def uniq_key
return nil if (@exception.backtrace.nil? || @exception.backtrace.empty?)
Digest::MD5.hexdigest(@exception.backtrace.join)
end
|