Module: Nestegg::NestingException

Defined in:
lib/nestegg/nesting_exception.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#causeObject (readonly)

Returns the value of attribute cause.



4
5
6
# File 'lib/nestegg/nesting_exception.rb', line 4

def cause
  @cause
end

Instance Method Details

#initialize(message = nil, cause = $!) ⇒ Object



6
7
8
# File 'lib/nestegg/nesting_exception.rb', line 6

def initialize message = nil, cause = $!
  @cause = cause
end

#set_backtrace(bt) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/nestegg/nesting_exception.rb', line 10

def set_backtrace bt
  if cause
    cause.backtrace.reverse.each do |line|
      if bt.last == line
        bt.pop
      else
        break
      end
    end
    bt << "cause: #{cause.class.name}: #{cause}"
    bt.concat cause.backtrace
  end
  super bt
end