Class: Aws::Plugins::S3CompleteMultipartUploadFix::Handler

Inherits:
Seahorse::Client::Handler show all
Defined in:
aws-sdk-core/lib/aws-sdk-core/plugins/s3_complete_multipart_upload_fix.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Handler

#handler

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Handler

#initialize, #inspect

Constructor Details

This class inherits a constructor from Seahorse::Client::Handler

Instance Method Details

#call(context) ⇒ Object


9
10
11
12
13
14
15
16
17
# File 'aws-sdk-core/lib/aws-sdk-core/plugins/s3_complete_multipart_upload_fix.rb', line 9

def call(context)
  @handler.call(context).on(200) do |response|
    if error = check_for_error(context)
      context.http_response.status_code = 500
      response.data = nil
      response.error = error
    end
  end
end

#check_for_error(context) ⇒ Object


19
20
21
22
23
24
25
26
# File 'aws-sdk-core/lib/aws-sdk-core/plugins/s3_complete_multipart_upload_fix.rb', line 19

def check_for_error(context)
  xml = MultiXml.parse(context.http_response.body_contents)
  if xml['Error']
    error_code = xml['Error']['Code']
    error_message = xml['Error']['Message']
    S3::Errors.error_class(error_code).new(context, error_message)
  end
end