Class: Cucumber::Distrib::Events::Exception
- Inherits:
-
Object
- Object
- Cucumber::Distrib::Events::Exception
- Defined in:
- lib/cucumber/distrib/events.rb
Overview
Object that mimic exception on the Leader for reporters.
Instance Attribute Summary collapse
-
#backtrace ⇒ Object
readonly
Returns the value of attribute backtrace.
-
#cause ⇒ Object
readonly
Returns the value of attribute cause.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#original_class ⇒ Object
readonly
Returns the value of attribute original_class.
Instance Method Summary collapse
-
#class ⇒ Object
This is used to present proper names for exceptions in cucumber reports.
-
#initialize(exception, propagate_cause: true) ⇒ Exception
constructor
A new instance of Exception.
- #set_backtrace(backtrace) ⇒ Object
Constructor Details
#initialize(exception, propagate_cause: true) ⇒ Exception
Returns a new instance of Exception.
128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/cucumber/distrib/events.rb', line 128 def initialize(exception, propagate_cause: true) @original_class = if exception.is_a?(Class) exception.to_s else exception.class.to_s end @backtrace = exception.backtrace @cause = Exception.new(exception.cause, propagate_cause: false) if exception.cause && propagate_cause = exception. end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace.
125 126 127 |
# File 'lib/cucumber/distrib/events.rb', line 125 def backtrace @backtrace end |
#cause ⇒ Object (readonly)
Returns the value of attribute cause.
125 126 127 |
# File 'lib/cucumber/distrib/events.rb', line 125 def cause @cause end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
125 126 127 |
# File 'lib/cucumber/distrib/events.rb', line 125 def end |
#original_class ⇒ Object (readonly)
Returns the value of attribute original_class.
125 126 127 |
# File 'lib/cucumber/distrib/events.rb', line 125 def original_class @original_class end |
Instance Method Details
#class ⇒ Object
This is used to present proper names for exceptions in cucumber reports.
146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/cucumber/distrib/events.rb', line 146 def class klass = original_class Class.new(::Cucumber::Distrib::Events::Exception).tap do |wrapper| wrapper.define_singleton_method :to_s do klass end wrapper.define_singleton_method :inspect do "Cucumber::Distrib::Events::Exception(#{self})" end end end |
#set_backtrace(backtrace) ⇒ Object
141 142 143 |
# File 'lib/cucumber/distrib/events.rb', line 141 def set_backtrace(backtrace) # rubocop:disable Naming/AccessorMethodName as on original interface @backtrace = backtrace end |