Exception: Awsum::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/awsum/error.rb

Defined Under Namespace

Classes: ErrorParser

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
10
11
12
13
# File 'lib/awsum/error.rb', line 5

def initialize(response)
  @response_code = response.code
  parser = ErrorParser.new
  parser.parse(response.body)
  @code = parser.code
  @message = parser.message
  @request_id = parser.request_id
  @additional = parser.additional
end

Instance Attribute Details

#additionalObject (readonly)

Returns the value of attribute additional.



3
4
5
# File 'lib/awsum/error.rb', line 3

def additional
  @additional
end

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/awsum/error.rb', line 3

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/awsum/error.rb', line 3

def message
  @message
end

#request_idObject (readonly)

Returns the value of attribute request_id.



3
4
5
# File 'lib/awsum/error.rb', line 3

def request_id
  @request_id
end

#response_codeObject (readonly)

Returns the value of attribute response_code.



3
4
5
# File 'lib/awsum/error.rb', line 3

def response_code
  @response_code
end

Instance Method Details

#inspectObject



15
16
17
# File 'lib/awsum/error.rb', line 15

def inspect
  "#<Awsum::Error response_code=#{@response_code} code=#{@code} request_id=#{@request_id} message=#{@message}>"
end