Class: DeepTest::MarshallableExceptionWrapper
- Inherits:
-
Object
- Object
- DeepTest::MarshallableExceptionWrapper
- Defined in:
- lib/deep_test/marshallable_exception_wrapper.rb
Instance Attribute Summary collapse
-
#backtrace ⇒ Object
readonly
Returns the value of attribute backtrace.
-
#classname ⇒ Object
readonly
Returns the value of attribute classname.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(exception) ⇒ MarshallableExceptionWrapper
constructor
A new instance of MarshallableExceptionWrapper.
- #resolve ⇒ Object
Constructor Details
#initialize(exception) ⇒ MarshallableExceptionWrapper
Returns a new instance of MarshallableExceptionWrapper.
5 6 7 8 9 |
# File 'lib/deep_test/marshallable_exception_wrapper.rb', line 5 def initialize(exception) @classname = exception.class.name @message = exception. @backtrace = exception.backtrace end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace.
3 4 5 |
# File 'lib/deep_test/marshallable_exception_wrapper.rb', line 3 def backtrace @backtrace end |
#classname ⇒ Object (readonly)
Returns the value of attribute classname.
3 4 5 |
# File 'lib/deep_test/marshallable_exception_wrapper.rb', line 3 def classname @classname end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/deep_test/marshallable_exception_wrapper.rb', line 3 def @message end |
Instance Method Details
#==(other) ⇒ Object
11 12 13 14 15 |
# File 'lib/deep_test/marshallable_exception_wrapper.rb', line 11 def ==(other) classname == other.classname && == other. && backtrace == other.backtrace end |
#resolve ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/deep_test/marshallable_exception_wrapper.rb', line 17 def resolve begin klass = eval("::" + classname) = rescue => e DeepTest.logger.debug("Unable to load exception class: #{classname}: #{e.}") DeepTest.logger.debug(e.backtrace.join("\n")) klass = UnloadableException = "#{classname}: #{}" end begin resolved_exception = klass.new rescue => e DeepTest.logger.debug("Unable to instantiation exception class: #{classname}: #{e.}") DeepTest.logger.debug(e.backtrace.join("\n")) resolved_exception = UnloadableException.new end resolved_exception.set_backtrace backtrace resolved_exception end |