public static CloudStorageException toCloudStorageException(String message, Throwable e, AzureMetrics azureMetrics) {
    Long retryDelayMs = null;
    int statusCode;
    if (e instanceof BlobStorageException) {
      if (azureMetrics != null) {
        azureMetrics.storageErrorCount.inc();
      }
      statusCode = ((BlobStorageException) e).getStatusCode();
    } else if (e instanceof CosmosException) {
      if (azureMetrics != null) {
        azureMetrics.documentErrorCount.inc();
      }
      statusCode = ((CosmosException) e).getStatusCode();
      retryDelayMs = ((CosmosException) e).getRetryAfterDuration().toMillis();
    } else {
      // Note: catch-all since ABS can throw things like IOException, IllegalStateException
      if (azureMetrics != null) {
        azureMetrics.storageErrorCount.inc();
      }
      statusCode = HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR;
    }
    // Everything is retryable except NOT_FOUND
    boolean isRetryable = (statusCode != NOTFOUND && !(e instanceof StoreException));
    return new CloudStorageException(message, e, statusCode, isRetryable, retryDelayMs);
  }
Test constructor.
@param storageAsyncClient the {@link BlobServiceAsyncClient} to use.
@param blobBatchAsyncClient the {@link BlobBatchAsyncClient} to use.
@param cosmosAsyncClient the {@link CosmosAsyncClient} to use.
@param cosmosAsyncDatabase the {@link CosmosAsyncDatabase} to use.
@param cosmosAsyncContainer the {@link CosmosAsyncContainer} to use.
@param cosmosDatabase the cosmos Database to use.
@param cosmosContainerForMetadata the CosmosDB collection to use for blob metadata.
@param cosmosContainerForDeletedAmbryContainers the CosmosDB collection to use for deleted Containers.
@param clusterName the name of the Ambry cluster.
@param azureMetrics the {@link AzureMetrics} to use.
@param azureReplicationFeedType the {@link AzureReplicationFeed.FeedType} to use for replication from Azure.
@param clusterMap {@link ClusterMap} object.
@param isVcr whether this instance is a VCR.
ambry-cloud/src/main/java/com/github/ambry/cloud/azure/AzureCloudDestination.java