Exception: AWS::SES::ResponseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/aws/ses/response.rb

Overview

Requests whose response code is between 300 and 599 and contain an <Error></Error> in their body are wrapped in an Error::Response. This Error::Response contains an Error object which raises an exception that corresponds to the error in the response body. The exception object contains the ErrorResponse, so in all cases where a request happens, you can rescue ResponseError and have access to the ErrorResponse and its Error object which contains information about the ResponseError.

begin
  Bucket.create(..)
rescue ResponseError => exception
 exception.response
 # => <Error::Response>
 exception.response.error
 # => <Error>
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ResponseError

Returns a new instance of ResponseError.


91
92
93
94
# File 'lib/aws/ses/response.rb', line 91

def initialize(response)
  @response = response
  super("AWS::SES Response Error: #{message}")
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response


90
91
92
# File 'lib/aws/ses/response.rb', line 90

def response
  @response
end

Instance Method Details

#codeObject


96
97
98
# File 'lib/aws/ses/response.rb', line 96

def code
  @response.code
end

#inspectObject


104
105
106
# File 'lib/aws/ses/response.rb', line 104

def inspect
  "#<%s:0x%s %s %s '%s'>" % [self.class.name, object_id, @response.request_id, code, message]
end

#messageObject


100
101
102
# File 'lib/aws/ses/response.rb', line 100

def message
  "#{@response.error['Code']} - #{@response.error['Message']}"
end