-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide ErrorMetadata
to crate::fuse
layer with errors from the client
#882
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Just a few suggestions.
I was unsure about returning the metadata by reference, by I see this the approach in the Rust SDK, so it may be worth to adopt as well.
Before finalizing, can you try and implement the propagation for another type of error, so we can get a better picture?
…ror parser calls Signed-off-by: Vladislav Volodkin <vlaad@amazon.co.uk>
Signed-off-by: Vladislav Volodkin <vlaad@amazon.co.uk>
7b603de
to
2ec7627
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Just a few minor suggestions.
try_parse_canceled_request(request_result).or_else(|| try_parse_no_credentials(request_result)) | ||
}), | ||
0 => { | ||
if let Some(err) = try_parse_throttled(request_result) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this is fine, but inconsistent with the 400
case. I'd leave it as a chain of .or_else
.
#[error("Forbidden: {0}")] | ||
Forbidden(String), | ||
Forbidden(String, Box<ClientErrorMetadata>), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: I'd just simplify this case as well and add optional code and status here
} | ||
Self::Forbidden(_, metadata) => (**metadata).clone(), | ||
Self::Throttled => { | ||
// CRT does not set S3 response data for error codes other then AWS_ERROR_S3_INVALID_RESPONSE_STATUS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: not sure this comment is relevant anymore. Maybe some of it (the first two lines?) could make more sense in try_parse_throttled
.
E: ProvideErrorMetadata + std::error::Error + Send + Sync + 'static, | ||
{ | ||
let metadata = ErrorMetadata { | ||
client_error_meta: err.meta().clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to clone, right?
@@ -353,7 +353,7 @@ impl RemoteIter { | |||
self.full_path.as_str(), | |||
) | |||
.await | |||
.map_err(|e| InodeError::ClientError(anyhow::Error::new(e)))?; | |||
.map_err(|e| InodeError::client_error(e, None, &self.bucket, &self.full_path))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit: should we just add a context string here as well? And simply make it non-optional?
Note
The majority of the changes (
646
lines) are for the updatedCargo.lock
caused by the addition ofhttpmock
dev dependencyDescription of change
ProvideErrorMetadata
trait aims to provide additional information with errors. After this change, code infuse.rs
can accesserror_code
,http_code
,s3_error_code
and some other fields for errors occurring onS3FuseFilesystem::lookup()
(for other fuse operations we currently return no metadata). Currently, we don't use this information in any way apart from the tests.lookup
errors: forbidden, throttled, not found, unhandled error from s3;Relevant issues: None
What is not in this change
read()
will have noerror_code
orhttp_code
);HeadObjectError::NotFound
andListObjectsError::NoSuchBucket
;ProvideErrorMetadata
trait.Does this change impact existing behavior?
This does not change any behaviour visible to customer.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).