lib/net/amazon/s3.rb
# Raises the appropriate error if the specified Net::HTTPResponse object
# contains an Amazon S3 error; returns +false+ otherwise.
Raises the appropriate error if the specified Net::HTTPResponse object
contains an Amazon S3 error; returns +false+ otherwise.
Raises the appropriate error if the specified Net :: HTTPResponse object contains an Amazon S3 error ; returns + false + otherwise .
def error?(response)
      return false if response.is_a?(Net::HTTPSuccess)
      xml = REXML::Document.new(response.body)
      unless xml.root.name == 'Error'
        raise S3Error, "Unknown error: #{response.body}"
      end
      error_code    = xml.root.elements['Code'].text
      error_message = xml.root.elements['Message'].text
      if S3Error.const_defined?(error_code)
        raise S3Error.const_get(error_code), error_message
      else
        raise S3Error, "#{error_code}: #{error_message}"
      end
    end
def error? ( response ) return false if response . is_a? ( Net :: HTTPSuccess ) xml = REXML :: Document . new ( response . body ) unless xml . root . name == 'Error' raise S3Error , "Unknown error: #{response.body}" end error_code = xml . root . elements [ 'Code' ] . text error_message = xml . root . elements [ 'Message' ] . text if S3Error . const_defined? ( error_code ) raise S3Error . const_get ( error_code ) , error_message else raise S3Error , "#{error_code}: #{error_message}" end end
Raises the appropriate error if the specified Net::HTTPResponse object
contains an Amazon S3 error; returns +false+ otherwise.
Raises the appropriate error if the specified Net :: HTTPResponse object contains an Amazon S3 error ; returns + false + otherwise .
response
<not_specific>