Пример #1
0
        public static bool TryHandleStorageException(AzureStorageException ex)
        {
            if (IsDoesntExist(ex))
            {
                throw new StorageException(ErrorCode.NotFound, ex);
            }

            return(false);
        }
Пример #2
0
 public static void LogStorageExceptions(AggregateException aggregate,
                                         Action <Microsoft.Azure.Cosmos.Table.StorageException> tableStorageLogger = null,
                                         Action <Microsoft.Azure.Storage.StorageException> blobStorageLogger       = null)
 {
     if (aggregate.InnerExceptions != null)
     {
         foreach (Exception ex in aggregate.InnerExceptions)
         {
             Microsoft.Azure.Cosmos.Table.StorageException tableStorageException = ex as Microsoft.Azure.Cosmos.Table.StorageException;
             if (tableStorageException != null)
             {
                 tableStorageLogger?.Invoke(tableStorageException);
             }
             Microsoft.Azure.Storage.StorageException blobException = ex as Microsoft.Azure.Storage.StorageException;
             if (blobException != null)
             {
                 blobStorageLogger?.Invoke(blobException);
             }
         }
     }
 }
Пример #3
0
 public static bool IsDoesntExist(AzureStorageException ex)
 {
     return(ex.RequestInformation?.HttpStatusCode == 404);
 }