class Aws::S3::Plugins::Http200Errors::Handler

def check_for_error(context)

def check_for_error(context)
  xml = context.http_response.body_contents
  if xml.match(/<\?xml\s[^>]*\?>\s*<Error>/)
    error_code = xml.match(%r{<Code>(.+?)</Code>})[1]
    error_message = xml.match(%r{<Message>(.+?)</Message>})[1]
    S3::Errors.error_class(error_code).new(context, error_message)
  elsif incomplete_xml_body?(xml, context.operation.output)
    Seahorse::Client::NetworkingError.new(
      S3::Errors
        .error_class('InternalError')
        .new(context, 'Empty or incomplete response body')
    )
  end
end