Azure / azure-storage-net

Microsoft Azure Storage Libraries for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not invent HttpStatus codes when one was not recieved

johnterickson opened this issue · comments

This section of code has bitten us multiple times. If a HttpStatus code is not received over the wire, then the SDK should not pretend one was.

When it fabricates a status code it makes debugging very difficult.

else if (ex is TimeoutException)
{
reqResult.HttpStatusMessage = null;
reqResult.HttpStatusCode = (int)HttpStatusCode.RequestTimeout;
reqResult.ExtendedErrorInformation = null;
return new StorageException(reqResult, ex.Message, ex);
}
else if (ex is ArgumentException)
{
reqResult.HttpStatusMessage = null;
reqResult.HttpStatusCode = (int)HttpStatusCode.Unused;
reqResult.ExtendedErrorInformation = null;
return new StorageException(reqResult, ex.Message, ex) { IsRetryable = false };
}
else if (ex is OperationCanceledException)
{
reqResult.HttpStatusMessage = null;
reqResult.HttpStatusCode = 306; // unused
reqResult.ExtendedErrorInformation = null;
return new StorageException(reqResult, ex.Message, ex);
}