Example #1
0
        /// <summary>
        /// Inspect an exception returned from Azure storage libraries to check whether it means that attempt was made to read some data that does not exist in storage table.
        /// </summary>
        /// <param name="exc">Exception that was returned by Azure storage library operation</param>
        /// <returns><c>True</c> if this exception means the data being read was not present in Azure table storage</returns>
        public static bool TableStorageDataNotFound(Exception exc)
        {
            HttpStatusCode httpStatusCode;
            string         restStatus;

            if (AzureStorageUtils.EvaluateException(exc, out httpStatusCode, out restStatus, true))
            {
                if (AzureStorageUtils.IsNotFoundError(httpStatusCode)
                    /* New table: Azure table schema not yet initialized, so need to do first create */)
                {
                    return(true);
                }
                return(StorageErrorCodeStrings.ResourceNotFound.Equals(restStatus));
            }
            return(false);
        }