Exception: Aws::AwsError2

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/awsbase/errors.rb

Overview

Simplified version

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_code = nil, request_id = nil, request_data = nil, response = nil) ⇒ AwsError2

Returns a new instance of AwsError2.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/awsbase/errors.rb', line 103

def initialize(http_code=nil, request_id=nil, request_data=nil, response=nil)

  @request_id   = request_id
  @http_code    = http_code
  @request_data = request_data
  @response     = response
#            puts '@response=' + @response.inspect

  if @response
    ref = XmlSimple.xml_in(@response, {"ForceArray"=>false})
#                puts "refxml=" + ref.inspect
    msg = "#{ref['Error']['Code']}: #{ref['Error']['Message']}"
  else
    msg = "#{@http_code}: REQUEST(#{@request_data})"
  end
  msg += "\nREQUEST ID=#{@request_id} " unless @request_id.nil?
  super(msg)
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



101
102
103
# File 'lib/awsbase/errors.rb', line 101

def errors
  @errors
end

#http_codeObject (readonly)

Response HTTP error code



94
95
96
# File 'lib/awsbase/errors.rb', line 94

def http_code
  @http_code
end

#request_dataObject (readonly)

Raw request text data to AWS



97
98
99
# File 'lib/awsbase/errors.rb', line 97

def request_data
  @request_data
end

#request_idObject (readonly)

Request id (if exists)



91
92
93
# File 'lib/awsbase/errors.rb', line 91

def request_id
  @request_id
end

#responseObject (readonly)

Returns the value of attribute response.



99
100
101
# File 'lib/awsbase/errors.rb', line 99

def response
  @response
end