aws/aws-sdk-ruby

Report errors leading to failure to abort multipart upload

janklimo opened this issue · 3 comments

Describe the feature

Report upload errors that trigger multipart upload abort. In this code, the original errors get lost if the exception is raised while aborting the upload.

def abort_upload(upload_id, options, errors)
@client.abort_multipart_upload(
bucket: options[:bucket],
key: options[:key],
upload_id: upload_id
)
msg = "multipart upload failed: #{errors.map(&:message).join("; ")}"
raise MultipartUploadError.new(msg, errors)
rescue MultipartUploadError => error
raise error
rescue => error
msg = "failed to abort multipart upload: #{error.message}"
raise MultipartUploadError.new(msg, errors + [error])
end

The exception thrown being

Seahorse::Client::NetworkingError
Failed to open TCP connection to xxx.s3.eu-central-1.amazonaws.com:443 (getaddrinfo: Temporary failure in name resolution) (Seahorse::Client::NetworkingError)

Use Case

Started seeing these errors pop up recently:

Aws::S3::MultipartUploadError
failed to abort multipart upload: Failed to open TCP connection to xxx.s3.eu-central-1.amazonaws.com:443 (getaddrinfo: Temporary failure in name resolution) (Aws::S3::MultipartUploadError)

It would be useful to see what upload errors lead up to the abort.

Proposed Solution

Report MultipartUploadError with a list of original upload errors, together with any subsequent errors.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

aws-sdk-s3 (1.143.0)

Environment details (OS name and version, etc.)

macOS 14.3.1

I believe the errors that resulted in the upload being aborted should be accessible through the errors accessor on the MultipartUploadError that is raised, but they aren't exposed in the message.

Maybe we should add those to the message or add a to_s method that will include them?

msg = "failed to abort multipart upload: #{error.message}" 

This should probably be similar to line 104 - we should collect the errors for the message and put them on the accessor

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.