Exception: Gossip::MultiException
- Inherits:
-
StandardError
- Object
- StandardError
- Gossip::MultiException
- Defined in:
- lib/gossip/multi-exceptions.rb
Overview
This collects exceptions from several threads and packages them up into a single exception.
Instance Attribute Summary collapse
-
#traces ⇒ Object
readonly
Returns the value of attribute traces.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(exceptions) ⇒ MultiException
constructor
A new instance of MultiException.
Constructor Details
#initialize(exceptions) ⇒ MultiException
Returns a new instance of MultiException.
27 28 29 30 31 |
# File 'lib/gossip/multi-exceptions.rb', line 27 def initialize(exceptions) = exceptions.collect { | ex | "#{ex.to_s} (#{ex.class})" } super(.join("\n")) @traces = exceptions.collect { | ex | ex.backtrace } end |
Instance Attribute Details
#traces ⇒ Object (readonly)
Returns the value of attribute traces.
25 26 27 |
# File 'lib/gossip/multi-exceptions.rb', line 25 def traces @traces end |
Class Method Details
.reraise_with_combined_backtrace ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/gossip/multi-exceptions.rb', line 33 def self.reraise_with_combined_backtrace yield rescue MultiException => ex ex.traces.each_with_index { | trace, index | trace.unshift("Trace number #{index}:\n") } ex.set_backtrace(ex.traces.flatten) raise end |