StorageExceptionExtensions
Provide helpful information about errors calling Azure Storage endpoints.
using Azure.Core;
namespace Azure.Storage
{
internal static class StorageExceptionExtensions
{
public static string GetErrorCode(this Response response, string errorCode)
{
if (string.IsNullOrEmpty(errorCode)) {
ResponseHeaders headers = response.get_Headers();
headers.TryGetValue("x-ms-error-code", ref errorCode);
}
return errorCode;
}
public static bool <>(this Response<T> response)
{
return (response?.GetRawResponse().get_Status() ?? 0) == 304;
}
public static Response<T> AsNoBodyResponse<T>(this Response rawResponse)
{
return new NoBodyResponse<T>(rawResponse);
}
}
}