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.



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

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

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



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

def response
  @response
end

Instance Method Details

#codeObject



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

def code
  @response.code
end

#inspectObject



107
108
109
# File 'lib/aws/ses/response.rb', line 107

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

#messageObject



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

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