0
votes

This may be silly question but I need to find the C# Azure Storage Exception API that wrap “Common REST API Error codes” https://msdn.microsoft.com/en-us/library/azure/dd179357.aspx.

Say if it is specific exception on a table operation then we can check error code against “Microsoft.WindowsAzure.Storage.Table.Protocol.TableErrorCodeStrings”

I have functionality that wrap creation of Table/Blob/Queue operation in a single method and checking an error type ResourceAlreadyExists while exception handling.

I see this error code ResourceAlreadyExists in Azure Storage Common REST API Error codes as per the documentation but not able to find the corresponding C# Azure Storage API.

Please let me know if you have some insight into this or how can I find it.

2

2 Answers

1
votes

I think you're reading too literally into the REST API documentation. :) Here are the strings for resources that already exist.

Microsoft.WindowsAzure.Storage.Blob.Protocol.BlobErrorCodeStrings.BlobAlreadyExists;
Microsoft.WindowsAzure.Storage.Queue.Protocol.QueueErrorCodeStrings.QueueAlreadyExists;
Microsoft.WindowsAzure.Storage.Table.Protocol.TableErrorCodeStrings.TableAlreadyExists;

So, you will need to check for the appropriate one depending on which Azure storage resource you are working with at that time.

1
votes

Those error codes are located in Microsoft.WindowsAzure.Storage.Shared.Protocol.StorageErrorCodeStrings class. Please see the MSDN documentation here and the source code here.

However, please note that these constants are simply set to the error code strings defined in the REST API documentation.