Skip to content

Commit

Permalink
Throw any error from MinIO with ListObject APIs (#214)
Browse files Browse the repository at this point in the history
* Throw any error from MinIO when listing objects
* Capture ListObjectsAsync exceptions in VerifyObjectExistsAsync
* Configure minio client timeout
* Throw VerifyObjectsException on error
* Convert MinIO exception with custom exceptions
* Update API doc

Signed-off-by: Victor Chang <[email protected]>
  • Loading branch information
mocsharp committed Jan 2, 2024
1 parent 8a74e9f commit e6d1220
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Plugins/MinIO/Tests/Unit/MinIoStorageServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ await Assert.ThrowsAsync<OperationCanceledException>(async () =>
break;
}
}
<<<<<<< HEAD
return await Task.FromResult(Disposable.Empty).ConfigureAwait(false);
=======
return Disposable.Empty;
>>>>>>> 1757165 (Throw any error from MinIO with ListObject APIs (#214))
});
var service = new MinIoStorageService(_minIoClientFactory.Object, _amazonStsClient.Object, _options, _logger.Object);
_bucketOperations.Setup(p => p.ListObjectsAsync(It.IsAny<ListObjectsArgs>(), It.IsAny<CancellationToken>()))
Expand All @@ -121,7 +125,11 @@ await Assert.ThrowsAsync<ListObjectException>(async () =>
obs.OnNext(new Item { Key = "key", ETag = "etag", Size = 1, IsDir = false });
obs.OnError(new Exception("error"));
obs.OnCompleted();
<<<<<<< HEAD
return await Task.FromResult(Disposable.Empty).ConfigureAwait(false);
=======
return Disposable.Empty;
>>>>>>> 1757165 (Throw any error from MinIO with ListObject APIs (#214))
});
var service = new MinIoStorageService(_minIoClientFactory.Object, _amazonStsClient.Object, _options, _logger.Object);
_bucketOperations.Setup(p => p.ListObjectsAsync(It.IsAny<ListObjectsArgs>(), It.IsAny<CancellationToken>()))
Expand Down
7 changes: 7 additions & 0 deletions src/Storage/API/StorageConnectionException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ namespace Monai.Deploy.Storage.API
{
public class StorageConnectionException : Exception
{
<<<<<<< HEAD
public string ServerMessage { get; set; } = default!;
=======
public string ServerMessage { get; set; }
>>>>>>> 1757165 (Throw any error from MinIO with ListObject APIs (#214))
public List<string> Errors { get; set; }

public StorageConnectionException()
Expand All @@ -40,7 +44,10 @@ public StorageConnectionException(string message, Exception innerException) : ba

protected StorageConnectionException(SerializationInfo info, StreamingContext context) : base(info, context)
{
<<<<<<< HEAD
Errors = new List<string>();
=======
>>>>>>> 1757165 (Throw any error from MinIO with ListObject APIs (#214))
}
}
}

0 comments on commit e6d1220

Please sign in to comment.