Exception: S3::Error::ResponseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/s3/exceptions.rb

Overview

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.

Direct Known Subclasses

AccessDenied, AccountProblem, AmbiguousGrantByEmailAddress, BadDigest, BucketAlreadyExists, BucketAlreadyOwnedByYou, BucketNotEmpty, CredentialsNotSupported, CrossLocationLoggingProhibited, EntityTooLarge, EntityTooSmall, ExpiredToken, IncompleteBody, IncorrectNumberOfFilesInPostRequestPOST, InlineDataTooLarge, InternalError, InvalidAccessKeyId, InvalidAddressingHeader, InvalidArgument, InvalidBucketName, InvalidDigest, InvalidLocationConstraint, InvalidPayer, InvalidPolicyDocument, InvalidRange, InvalidSOAPRequest, InvalidSecurity, InvalidStorageClass, InvalidTargetBucketForLogging, InvalidToken, InvalidURI, KeyTooLong, MalformedACLError, MalformedPOSTRequest, MalformedXML, MaxMessageLengthExceeded, MaxPostPreDataLengthExceededErrorYour, MetadataTooLarge, MethodNotAllowed, MissingAttachment, MissingContentLength, MissingRequestBodyError, MissingSecurityElement, MissingSecurityHeader, NoLoggingStatusForKey, NoSuchBucket, NoSuchKey, NotImplemented, NotSignedUp, OperationAborted, PermanentRedirect, PreconditionFailed, Redirect, RequestIsNotMultiPartContent, RequestTimeTooSkewed, RequestTimeout, RequestTorrentOfBucketError, SignatureDoesNotMatch, SlowDown, TemporaryRedirect, TokenRefreshRequired, TooManyBuckets, UnexpectedContent, UnresolvableGrantByEmailAddress, UserKeyMustBeSpecified

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ResponseError) initialize(message, response)

Creates new S3::ResponseError.

Parameters

  • message - what went wrong

  • response - Net::HTTPResponse object or nil



20
21
22
23
# File 'lib/s3/exceptions.rb', line 20

def initialize(message, response)
  @response = response
  super(message)
end

Instance Attribute Details

- (Object) response (readonly)

Returns the value of attribute response



13
14
15
# File 'lib/s3/exceptions.rb', line 13

def response
  @response
end

Class Method Details

+ (Object) exception(code)

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



34
35
36
37
38
# File 'lib/s3/exceptions.rb', line 34

def self.exception(code)
  S3::Error.const_get(code)
rescue NameError
  ResponseError
end