diff --git a/Minio/ApiEndpoints/BucketOperations.cs b/Minio/ApiEndpoints/BucketOperations.cs index 3614bf58a4..2cda3b0f90 100644 --- a/Minio/ApiEndpoints/BucketOperations.cs +++ b/Minio/ApiEndpoints/BucketOperations.cs @@ -80,9 +80,13 @@ public async Task BucketExistsAsync(BucketExistsArgs args, CancellationTok using var response = await this.ExecuteTaskAsync(ResponseErrorHandlers, requestMessageBuilder, cancellationToken: cancellationToken).ConfigureAwait(false); - return response is not null && - (response.Exception is null || - response.Exception.GetType() != typeof(BucketNotFoundException)); + if (response is not null && + response.Exception is null) + { + return true; + } + + throw response.Exception; } catch (InternalClientException ice) {