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

@@ -14,8 +14,9 @@
// limitations under the License.
use minio::s3::client::DEFAULT_REGION;
use minio::s3::error::{Error, ErrorCode};
use minio::s3::error::{Error, S3ServerError};
use minio::s3::lifecycle_config::LifecycleConfig;
use minio::s3::minio_error_response::MinioErrorCode;
use minio::s3::response::a_response_traits::{HasBucket, HasRegion};
use minio::s3::response::{
DeleteBucketLifecycleResponse, GetBucketLifecycleResponse, PutBucketLifecycleResponse,
@@ -74,10 +75,9 @@ async fn bucket_lifecycle(ctx: TestContext, bucket_name: String) {
let resp: Result<GetBucketLifecycleResponse, Error> =
ctx.client.get_bucket_lifecycle(&bucket_name).send().await;
match resp {
Err(Error::S3Error(e)) => assert_eq!(e.code, ErrorCode::NoSuchLifecycleConfiguration),
v => panic!(
"Expected error S3Error(NoSuchLifecycleConfiguration): but got {:?}",
v
),
Err(Error::S3Server(S3ServerError::S3Error(e))) => {
assert_eq!(e.code(), MinioErrorCode::NoSuchLifecycleConfiguration)
}
v => panic!("Expected error S3Error(NoSuchLifecycleConfiguration): but got {v:?}"),
}
}