Refactor/cleanup errors (#179)
Some checks failed
Rust Linters / rustfmt (push) Successful in 3m20s
rust-clippy analyze / Run rust-clippy analyzing (push) Failing after 1m5s

* error refactored: moved to thiserror
* Result type alias for better ergonomics:
* removed field from MinioErrorCode::BucketNotEmpty enum
* made field private of MinioErrorResponse
* updated XmlError
* simplified calling errors
* bumped toolchain channel form 1.86.0 to 1.87.0
* bumped toolchain channel form 1.87.0 to 1.88.0 due to clippy fixes that are not compatible with 1.87.0
This commit is contained in:
Henk-Jan Lebbink
2025-08-15 06:31:45 +02:00
committed by GitHub
parent e73fa1019c
commit 5080bf9b85
133 changed files with 2214 additions and 1701 deletions

View File

@@ -15,7 +15,8 @@
use minio::s3::builders::VersioningStatus;
use minio::s3::client::DEFAULT_REGION;
use minio::s3::error::{Error, ErrorCode};
use minio::s3::error::{Error, S3ServerError};
use minio::s3::minio_error_response::MinioErrorCode;
use minio::s3::response::a_response_traits::{HasBucket, HasRegion};
use minio::s3::response::{GetBucketVersioningResponse, PutBucketVersioningResponse};
use minio::s3::types::S3Api;
@@ -73,14 +74,18 @@ async fn bucket_versioning_s3express(ctx: TestContext, bucket_name: String) {
.send()
.await;
match resp {
Err(Error::S3Error(e)) => assert_eq!(e.code, ErrorCode::NotSupported),
v => panic!("Expected error S3Error(NotSupported): but got {:?}", v),
Err(Error::S3Server(S3ServerError::S3Error(e))) => {
assert_eq!(e.code(), MinioErrorCode::NotSupported)
}
v => panic!("Expected error S3Error(NotSupported): but got {v:?}"),
}
let resp: Result<GetBucketVersioningResponse, Error> =
ctx.client.get_bucket_versioning(&bucket_name).send().await;
match resp {
Err(Error::S3Error(e)) => assert_eq!(e.code, ErrorCode::NotSupported),
v => panic!("Expected error S3Error(NotSupported): but got {:?}", v),
Err(Error::S3Server(S3ServerError::S3Error(e))) => {
assert_eq!(e.code(), MinioErrorCode::NotSupported)
}
v => panic!("Expected error S3Error(NotSupported): but got {v:?}"),
}
}