Class: Amazon::AWS::Error::AWSError

Inherits:
Object
  • Object
show all
Defined in:
lib/amazon/aws.rb

Overview

An exception generator class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ AWSError

Returns a new instance of AWSError.



1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
# File 'lib/amazon/aws.rb', line 1156

def initialize(xml)
  err_class = xml.elements['Code'].text.sub( /^AWS.*\./, '' )
  err_msg = xml.elements['Message'].text

  unless Amazon::AWS::Error.const_defined?( err_class )
    Amazon::AWS::Error.const_set( err_class,
				  Class.new( StandardError ) )
  end

  ex_class = Amazon::AWS::Error.const_get( err_class )
  @exception = ex_class.new( err_msg )
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



1154
1155
1156
# File 'lib/amazon/aws.rb', line 1154

def exception
  @exception
end