aws-s3
aws-s3 copied to clipboard
proper handling of errors for s3 copy
From the Documentation:
There are two opportunities for a copy request to return an error. One can occur when Amazon S3 receives the copy request and the other can occur while Amazon S3 is copying the files. If the error occurs before the copy operation starts, you receive a standard Amazon S3 error. If the error occurs during the copy operation, the error response is embedded in the 200 OK response. This means that a 200 OK response can contain either a success or an error. Make sure to design your application to parse the contents of the response and handle it appropriately.
Current error checking is implemented as:
def error?
!success? && response['content-type'] == 'application/xml' && parsed.root == 'error'
end
where success? only returns true for response code 200..299
Basically, it looks like aws-s3 won't handle the case specified in the documentation