I am trying to port code that had been using Microsoft.WindowsAzure.Storage
classes to use the newer classes in Azure.Data.Tables
, Azure.Storage.Queues
, etc. From what I have been able to discern, the StorageException
class has been replaced by RequestFailedException
. Unfortunately, there are some properties in StorageException
that do not exist in RequestFailedException
, making it difficult to log appropriate messages when an exception is encountered (for example: RequestId
, RequestInformation
, etc.).
The migration document does not address the differences between StorageException
and the new RequestFailedException
, or how to get error details from it.
It seems that either the new libraries are not yet mature enough for prime time, or maybe it is just because the documentation is lacking the relevant information and I can't find the appropriate methodologies for getting all of the error information from the RequestFailedException
.
Does anyone know how to get more data out of the new class? Here are some examples of what we used to do:
catch (StorageException e)
{
operation.Telemetry.Properties.Add("AzureServiceRequestID", e.RequestInformation.ServiceRequestID);
Changing the above to use RequestFailedException
is a problem because RequestInformation
is not a property of RequestFailedException
.
Here is another case:
catch (StorageException se)
{
var ri = se.RequestInformation;
if (ri.ErrorCode == "TableNotFound")
{
Logger.Info(
$"{SJResult.MakeInfo(64)} {ri.HttpStatusCode} {ri.HttpStatusMessage}, Storage Service code={ri.ErrorCode} This is OK if HL7 has not yet received messages."); // 60240040
}
else
{
Logger.Error(
$"{SJResult.MakeError(65)} HttpStatusCode: {ri.HttpStatusCode}, HttpStatusMessage: {ri.HttpStatusMessage}, Storage Service code={ri.ErrorCode}, " +
$"Extended.ErrorCode: {ri.ExtendedErrorInformation.ErrorCode} Extended.ErrorMessage: {ri.ExtendedErrorInformation.ErrorMessage}"); // E0240041
throw;
}
Again, RequestInformation
is not available in RequestFailedException
.
How do we get access to all the detailed information (RequestInformation
) about an exception from the new RequestFailedException
class?