Class: Periskop::Client::ExceptionInstance
- Inherits:
-
Object
- Object
- Periskop::Client::ExceptionInstance
- Defined in:
- lib/periskop/client/models.rb
Overview
ExceptionInstance has all metadata of a reported exception
Instance Attribute Summary collapse
-
#cause ⇒ Object
Returns the value of attribute cause.
-
#class ⇒ Object
Returns the value of attribute class.
-
#message ⇒ Object
Returns the value of attribute message.
-
#stacktrace ⇒ Object
Returns the value of attribute stacktrace.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(_options = {}) ⇒ Object
-
#initialize(cls, message, stacktrace, cause) ⇒ ExceptionInstance
constructor
A new instance of ExceptionInstance.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(cls, message, stacktrace, cause) ⇒ ExceptionInstance
Returns a new instance of ExceptionInstance.
14 15 16 17 18 19 |
# File 'lib/periskop/client/models.rb', line 14 def initialize(cls, , stacktrace, cause) @class = cls @message = @stacktrace = stacktrace @cause = cause end |
Instance Attribute Details
#cause ⇒ Object
Returns the value of attribute cause.
12 13 14 |
# File 'lib/periskop/client/models.rb', line 12 def cause @cause end |
#class ⇒ Object
Returns the value of attribute class.
12 13 14 |
# File 'lib/periskop/client/models.rb', line 12 def class @class end |
#message ⇒ Object
Returns the value of attribute message.
12 13 14 |
# File 'lib/periskop/client/models.rb', line 12 def @message end |
#stacktrace ⇒ Object
Returns the value of attribute stacktrace.
12 13 14 |
# File 'lib/periskop/client/models.rb', line 12 def stacktrace @stacktrace end |
Class Method Details
.from_exception(exception) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/periskop/client/models.rb', line 21 def self.from_exception(exception) ExceptionInstance.new( exception.class.name, exception., exception.backtrace, get_cause(exception) ) end |
.get_cause(exception) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/periskop/client/models.rb', line 30 def self.get_cause(exception) if RUBY_VERSION > '2.0' if exception.cause.is_a?(Exception) return ExceptionInstance.from_exception(exception.cause) end end nil end |
Instance Method Details
#as_json(_options = {}) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/periskop/client/models.rb', line 40 def as_json( = {}) { class: @class, message: @message, stacktrace: @stacktrace, cause: @cause } end |
#to_json(*options) ⇒ Object
49 50 51 |
# File 'lib/periskop/client/models.rb', line 49 def to_json(*) as_json(*).to_json(*) end |