awslabs/mountpoint-s3

Enhance error reporting in the put_object operation.

Opened this issue · 0 comments

Mountpoint for Amazon S3 version

Latest version

AWS Region

No response

Describe the running environment

Running in local.

Mountpoint options

NA

What happened?

The current error handling approach in the put_object operation might not be providing sufficient detail. Specifically, when an error occurs during the put_object operation, we are only sending the crt_error part of the meta request result. This output often looks like:
Unknown CRT error: CRT error 14343: aws-c-s3: AWS_ERROR_S3_INVALID_RESPONSE_STATUS, Invalid response status from request
However, the actual error message from the meta request result provides much more clarity. For instance, the full meta request result includes details such as:

MetaRequestResult { response_status: 400, crt_error: Error(14343, "aws-c-s3: AWS_ERROR_S3_INVALID_RESPONSE_STATUS, Invalid response status from request"), error_response_headers: Some(Headers { inner: 0x6000014fc080 }), error_response_body: Some("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>InvalidToken</Code><Message>The provided token is malformed or otherwise invalid.</Message><Token-0>IQoJb3JpZ2luX2VjEDYaCXVzLWVhc3QtMSJIMEYCIQDLFxf8o3wpHIhdDU1dWFvOaHvEOkZOTtDiJRIaNQR2rAIhALPZYJkTUhXtlQK6mcOzR1FpGSKPKZ117zVW9oy+7nWcKp4CCF4QARoMMTE5NjgzNTA4OTE5IgwdiMsiu8ooxC/zMO4q+wGpjTiFPtq2zPMC0+K0czqQQFRVE1Vcmq/QtZDpVsX1vP5c8tfYtQo5GOFvxg1jGx+uUyS3gZ/dtt0gZAXhb1jyoiLz27loUtQHmQCSQNCPeaSTOOrUWP45FYEY3taGHfW+5wu4ersuS9GKcKjKH7BywHq//NU3YzUcwTd+qoTs89eHZeWxzm7kZ5YW5XmHHagAjwKMXlw+Sp+oEgZaYzOLkx4yT3u+CRQ1Wh5jnHxiKITvNXbpwRq4FjTCd3mcmS2KYwk9X2IdOS9IL3ZJfnb8jTe0ssmgj3axbbzVXdzqhcNTRhCVu3P2sFVvj92Fql1LiYsVrsRGyCAlfTCi5fu2BjqcAfThWbs+4+2ke/RRYuzpCcCIWaWkpzYFeLK5CBlgvoGWq4DttxrWcDk6ey6Ftnh5BUcR4T6MZubneVqyS39uc41OQi7qOZ1LYNPQ6NGRXJSyGeai7/+q/SPGGkegbQBgynB1wUoTGb+aMJNR3vSJWwIBH+SLsx5nNCBMlBLdadAHqVpV4RkRZERgHCO+wLtKw2+WwifG7</Token-0><RequestId>30GF3JD37PN8JRRZ</RequestId><HostId>75I4LL0gyd4AE/ClR1FMx72Ub/qNRZc378GHu4LCMUfU8WdDpO3/z5HWzYgZ2BVyuUMZ2+ZLi5XemPTVpolG1g==</HostId></Error>") }

To improve the visibility and accuracy of error reporting, I suggest enhancing the error handling in the put_object operation to properly parse and include both the crt_error and the more detailed error_response_body from the meta request result. This change would provide clearer insights into the nature of the issues encountered.

Relevant log output

No response