Module: Nesty::NestedError

Included in:
NestedStandardError
Defined in:
lib/nesty/nested_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nestedObject (readonly)

Returns the value of attribute nested.



3
4
5
# File 'lib/nesty/nested_error.rb', line 3

def nested
  @nested
end

#raw_backtraceObject (readonly)

Returns the value of attribute raw_backtrace.



3
4
5
# File 'lib/nesty/nested_error.rb', line 3

def raw_backtrace
  @raw_backtrace
end

Instance Method Details

#initialize(msg = nil, nested = $!) ⇒ Object



5
6
7
8
# File 'lib/nesty/nested_error.rb', line 5

def initialize(msg = nil, nested = $!)
  super(msg)
  @nested = nested
end

#set_backtrace(backtrace) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/nesty/nested_error.rb', line 10

def set_backtrace(backtrace)
  @raw_backtrace = backtrace
  if nested
    backtrace = backtrace - nested_raw_backtrace
    backtrace += ["#{nested.backtrace.first}: #{nested.message} (#{nested.class.name})"]
    backtrace += nested.backtrace[1..-1] || []
  end
  super(backtrace)
end