Reputation: 515
Name an Exception For UNIT_TESTCASE while uploading to AzureCloud BlobStorage .
My Code is ,
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve a reference to a container.
CloudBlobContainer container =
blobClient.GetContainerReference("myblogcontainer");
// Retrieve reference to a blob named "myblob".
CloudBlockBlob blockBlob =
container.GetBlockBlobReference("WeekendChamps.jpg");
// Create or overwrite the "myblob" blob with contents from a local file.
using (var fileStream =
System.IO.File.OpenRead(@"C:\Users\Bliss\Downloads\WeekendChamps.jpg"))
{
blockBlob.UploadFromStream(fileStream);
}
Upvotes: 0
Views: 48
Reputation: 4173
In the try catch block catch the StorageException and within the catch block you can process the exception to get the RequestInformation and the StorageExtendedErrorInformation.
There are various exception codes defined for Blobs in the BlobErrorCodeStrings class. You can do a switch case on the errorcodes or you can try to match any specific error codes that you require.
Upvotes: 1