You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experimenting with the library, and I get error responses from Amazon S3 in certain circumstances. The error response text is like this:
<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>PermanentRedirect</Code><Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message><Endpoint>s3.amazonaws.com</Endpoint><Bucket>...</Bucket><RequestId>...</RequestId><HostId>...</HostId></Error>
Now, I'm using examples/list_objects.rs as a basis for my code. The response status here is 301, so error_for_status() doesn't catch it, and the subsequent ListObjectsV2::parse_response() call on the response text produces a non-helpful error Custom("missing field `MaxKeys`").
Apparently I need to do more error handling: maybe make sure that the error code is always from the 2xx range, or "catch" parse errors and try to interpret the response as a error response. In any case, I need some way to parse the error response XML like the one I cited above. Is there any facility in rusty-s3 that would help me with it? I couldn't find any.
I think the library should have a error response type like ErrorResponse and a function to parse it, like parse_error_response. Maybe request objects should also have methods like parse_response_or_error that would automatically recognize, parse and return error responses.
The text was updated successfully, but these errors were encountered:
I'm experimenting with the library, and I get error responses from Amazon S3 in certain circumstances. The error response text is like this:
Now, I'm using
examples/list_objects.rs
as a basis for my code. The response status here is 301, soerror_for_status()
doesn't catch it, and the subsequentListObjectsV2::parse_response()
call on the response text produces a non-helpful errorCustom("missing field `MaxKeys`")
.Apparently I need to do more error handling: maybe make sure that the error code is always from the 2xx range, or "catch" parse errors and try to interpret the response as a error response. In any case, I need some way to parse the error response XML like the one I cited above. Is there any facility in rusty-s3 that would help me with it? I couldn't find any.
I think the library should have a error response type like
ErrorResponse
and a function to parse it, likeparse_error_response
. Maybe request objects should also have methods likeparse_response_or_error
that would automatically recognize, parse and return error responses.The text was updated successfully, but these errors were encountered: