Class: Cucumber::Messages::Exception
- Defined in:
- lib/cucumber/messages/exception.rb
Overview
Represents the Exception message in Cucumber’s message protocol.
A simplified representation of an exception
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
The message of exception that caused this result.
-
#stack_trace ⇒ Object
readonly
The stringified stack trace of the exception that caused this result.
-
#type ⇒ Object
readonly
The type of the exception that caused this result.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new Exception from the given hash.
Instance Method Summary collapse
-
#initialize(type: '', message: nil, stack_trace: nil) ⇒ Exception
constructor
A new instance of Exception.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(type: '', message: nil, stack_trace: nil) ⇒ Exception
Returns a new instance of Exception.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cucumber/messages/exception.rb', line 28 def initialize( type: '', message: nil, stack_trace: nil ) @type = type @message = @stack_trace = stack_trace super() end |
Instance Attribute Details
#message ⇒ Object (readonly)
The message of exception that caused this result. E.g. expected: “a” but was: “b”
21 22 23 |
# File 'lib/cucumber/messages/exception.rb', line 21 def @message end |
#stack_trace ⇒ Object (readonly)
The stringified stack trace of the exception that caused this result
26 27 28 |
# File 'lib/cucumber/messages/exception.rb', line 26 def stack_trace @stack_trace end |
#type ⇒ Object (readonly)
The type of the exception that caused this result. E.g. “Error” or “org.opentest4j.AssertionFailedError”
16 17 18 |
# File 'lib/cucumber/messages/exception.rb', line 16 def type @type end |
Class Method Details
.from_h(hash) ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/cucumber/messages/exception.rb', line 46 def self.from_h(hash) return nil if hash.nil? new( type: hash[:type], message: hash[:message], stack_trace: hash[:stackTrace] ) end |