Class: SOAP::Mapping::SOAPException

Inherits:
Object
  • Object
show all
Defined in:
lib/soap/mapping/encodedregistry.rb

Overview

Inner class to pass an exception.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(e) ⇒ SOAPException

Returns a new instance of SOAPException.



64
65
66
67
# File 'lib/soap/mapping/encodedregistry.rb', line 64

def initialize(e)
  @excn_type_name = Mapping.name2elename(e.class.to_s)
  @cause = e
end

Instance Attribute Details

#causeObject (readonly)

Returns the value of attribute cause.



62
63
64
# File 'lib/soap/mapping/encodedregistry.rb', line 62

def cause
  @cause
end

#excn_type_nameObject (readonly)

Returns the value of attribute excn_type_name.



62
63
64
# File 'lib/soap/mapping/encodedregistry.rb', line 62

def excn_type_name
  @excn_type_name
end

Instance Method Details

#to_eObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/soap/mapping/encodedregistry.rb', line 69

def to_e
  if @cause.is_a?(::Exception)
    @cause.extend(::SOAP::Mapping::MappedException)
    return @cause
  elsif @cause.respond_to?(:message) and @cause.respond_to?(:backtrace)
    e = RuntimeError.new(@cause.message)
    e.set_backtrace(@cause.backtrace)
    return e
  end
  klass = Mapping.class_from_name(Mapping.elename2name(@excn_type_name.to_s))
  if klass.nil? or not klass <= ::Exception
    return RuntimeError.new(@cause.inspect)
  end
  obj = klass.new(@cause.message)
  obj.extend(::SOAP::Mapping::MappedException)
  obj
end