Module: Trailblazer::Developer::Wtf::Exception::Stack
- Defined in:
- lib/trailblazer/developer/wtf.rb
Overview
When an exception occurs the Stack instance is incomplete - it is missing Captured::Output instances for Inputs still open. This method adds the missing elements so the Trace::Tree algorithm doesn’t crash.
Class Method Summary collapse
Class Method Details
.complete(incomplete_stack) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/trailblazer/developer/wtf.rb', line 58 def self.complete(incomplete_stack) processed = [] incomplete_stack.to_a.each do |captured| if captured.is_a?(Trace::Captured::Input) processed << captured else processed.pop end end missing_captured = processed.reverse.collect { |captured| Trace::Captured::Output.new(captured.task, captured.activity, {}) } Trace::Stack.new(incomplete_stack.to_a + missing_captured) end |