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.
91 92 93 94 |
# File 'lib/aws/ses/response.rb', line 91 def initialize(response) @response = response super("AWS::SES Response Error: #{}") end |
Instance Attribute Details
#response ⇒ Object (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
#code ⇒ Object
96 97 98 |
# File 'lib/aws/ses/response.rb', line 96 def code @response.code end |
#inspect ⇒ Object
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, ] end |
#message ⇒ Object
100 101 102 |
# File 'lib/aws/ses/response.rb', line 100 def "#{@response.error['Code']} - #{@response.error['Message']}" end |