class S3::Error::ResponseError

All responses with a code between 300 and 599 that contain an <Error></Error> body are wrapped in an ErrorResponse which contains an Error object. This Error class generates a custom exception with the name of the xml Error and its message. All such runtime generated exception classes descend from ResponseError and contain the ErrorResponse object so that all code that makes a request can rescue ResponseError and get access to the ErrorResponse.

Attributes

response[R]

Public Class Methods

exception(code) click to toggle source

Factory for all other Exception classes in module, each for every error response available from AmazonAWS

Parameters

  • code - Code name of exception

Returns

Descendant of ResponseError suitable for that exception code or ResponseError class if no class found

# File lib/s3/exceptions.rb, line 34
def self.exception(code)
  S3::Error.const_get(code)
rescue NameError
  ResponseError
end
new(message, response) click to toggle source

Creates new S3::ResponseError.

Parameters

  • message - what went wrong

  • response - Net::HTTPResponse object or nil

Calls superclass method
# File lib/s3/exceptions.rb, line 20
def initialize(message, response)
  @response = response
  super(message)
end