Module: SOAP::NestedException

Included in:
Error, WSDL::Error, XSD::Error
Defined in:
lib/soap/nestedexception.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#causeObject (readonly)

Returns the value of attribute cause.



13
14
15
# File 'lib/soap/nestedexception.rb', line 13

def cause
  @cause
end

#original_backtraaceObject (readonly)

Returns the value of attribute original_backtraace.



14
15
16
# File 'lib/soap/nestedexception.rb', line 14

def original_backtraace
  @original_backtraace
end

Instance Method Details

#initialize(msg = nil, cause = nil) ⇒ Object



16
17
18
19
20
# File 'lib/soap/nestedexception.rb', line 16

def initialize(msg = nil, cause = nil)
  super(msg)
  @cause = cause
  @original_backtrace = nil
end

#set_backtrace(backtrace) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/soap/nestedexception.rb', line 22

def set_backtrace(backtrace)
  if @cause and @cause.respond_to?(:backtrace)
    @original_backtrace = backtrace
=begin
    # for agressive backtrace abstraction: 'here' only should not be good
    here = @original_backtrace[0]
    backtrace = Array[*@cause.backtrace]
    backtrace[0] = "#{backtrace[0]}: #{@cause} (#{@cause.class})"
    backtrace.unshift(here)
=end
    # just join the nested backtrace at the tail of backtrace
    caused = Array[*@cause.backtrace]
    caused[0] = "#{caused[0]}: #{@cause} (#{@cause.class}) [NESTED]"
    backtrace += caused
  end
  super(backtrace)
end