class Cucumber::Messages::Exception

Represents the Exception message in Cucumber’s message protocol.

A simplified representation of an exception

Attributes

message[R]

The message of exception that caused this result. E.g. expected: “a” but was: “b”

stack_trace[R]

The stringified stack trace of the exception that caused this result

type[R]

The type of the exception that caused this result. E.g. “Error” or “org.opentest4j.AssertionFailedError”

Public Class Methods

from_h(hash) click to toggle source

Returns a new Exception from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.

Cucumber::Messages::Exception.from_h(some_hash) # => #<Cucumber::Messages::Exception:0x... ...>
# 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
new( type: '', message: nil, stack_trace: nil ) click to toggle source
Calls superclass method
# File lib/cucumber/messages/exception.rb, line 28
def initialize(
  type: '',
  message: nil,
  stack_trace: nil
)
  @type = type
  @message = message
  @stack_trace = stack_trace
  super()
end