Exception: AWS::SES::ResponseError
- Inherits:
-
StandardError
- Object
- StandardError
- AWS::SES::ResponseError
- 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
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(response) ⇒ ResponseError
constructor
A new instance of ResponseError.
- #inspect ⇒ Object
- #message ⇒ Object
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: #{}") end |
Instance Attribute Details
#response ⇒ Object (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
#code ⇒ Object
99 100 101 |
# File 'lib/aws/ses/response.rb', line 99 def code @response.code end |
#inspect ⇒ Object
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, ] end |
#message ⇒ Object
103 104 105 |
# File 'lib/aws/ses/response.rb', line 103 def "#{@response.error['Code']} - #{@response.error['Message']}" end |