Exception: S3Lib::S3ResponseError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, io, s3requester) ⇒ S3ResponseError

Returns a new instance of S3ResponseError.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/s3_errors.rb', line 6

def initialize(message, io, s3requester)
  @io = io
  # Get the response and status from the IO object
  @io.rewind
  @response = @io.read
  @io.rewind 
  @status = io.status
  
  # The Amazon Error type will always look like <Code>AmazonErrorType</Code>.  Find it with a RegExp.
  @response =~ /<Code>(.*)<\/Code>/
  @amazon_error_type = $1
  
  # Make the AuthenticatedRequest instance available as well
  @s3requester = s3requester
  
  # Call the standard Error initializer
  # if you put '%s' in the message it will be replaced by the amazon_error_type
  message += "\namazon error type: %s" unless message =~ /\%s/
  super(message % @amazon_error_type)
end

Instance Attribute Details

#amazon_error_typeObject (readonly)

Returns the value of attribute amazon_error_type.



5
6
7
# File 'lib/s3_errors.rb', line 5

def amazon_error_type
  @amazon_error_type
end

#ioObject (readonly)

Returns the value of attribute io.



5
6
7
# File 'lib/s3_errors.rb', line 5

def io
  @io
end

#responseObject (readonly)

Returns the value of attribute response.



5
6
7
# File 'lib/s3_errors.rb', line 5

def response
  @response
end

#s3requesterObject (readonly)

Returns the value of attribute s3requester.



5
6
7
# File 'lib/s3_errors.rb', line 5

def s3requester
  @s3requester
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/s3_errors.rb', line 5

def status
  @status
end