Exception: Rack::Remote::ChainedError
- Inherits:
-
StandardError
- Object
- StandardError
- Rack::Remote::ChainedError
- Defined in:
- lib/rack/remote.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cause ⇒ Object
readonly
Returns the value of attribute cause.
Instance Method Summary collapse
-
#initialize(*attrs) ⇒ ChainedError
constructor
A new instance of ChainedError.
- #set_backtrace(trace) ⇒ Object
Constructor Details
#initialize(*attrs) ⇒ ChainedError
Returns a new instance of ChainedError.
16 17 18 19 20 21 22 |
# File 'lib/rack/remote.rb', line 16 def initialize(*attrs) if attrs.last.is_a?(Hash) && attrs.last[:cause].is_a?(Exception) @cause = attrs.last.delete(:cause) attrs.pop if attrs.last.empty? end super *attrs end |
Instance Attribute Details
#cause ⇒ Object (readonly)
Returns the value of attribute cause.
14 15 16 |
# File 'lib/rack/remote.rb', line 14 def cause @cause end |
Instance Method Details
#set_backtrace(trace) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/rack/remote.rb', line 24 def set_backtrace(trace) trace.is_a?(Array) ? trace.map!(&:to_s) : trace = trace.to_s.split("\n") trace.map! { |line| " #{line}" } if cause trace << "caused by #{cause.class.name}: #{cause.}" trace += cause.backtrace.map! { |line| " #{line}" } end super trace end |