<PackageReference Include="Azure.Storage.Blobs" Version="12.25.0" />

BlobErrors

class BlobErrors : Errors
Create exceptions for common error cases.
using Azure.Storage.Blobs.Models; using System; using System.Runtime.CompilerServices; namespace Azure.Storage.Blobs { internal class BlobErrors : Errors { public static ArgumentOutOfRangeException BlobConditionsMustBeDefault(params string[] conditions) { return new ArgumentOutOfRangeException("The " + string.Join(" and ", conditions) + " conditions must have their default values because they are ignored by the blob service"); } public static InvalidOperationException BlobOrContainerMissing(string leaseClient, string blobBaseClient, string blobContainerClient) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(23, 3); defaultInterpolatedStringHandler.AppendFormatted(leaseClient); defaultInterpolatedStringHandler.AppendLiteral(" requires either a "); defaultInterpolatedStringHandler.AppendFormatted(blobBaseClient); defaultInterpolatedStringHandler.AppendLiteral(" or "); defaultInterpolatedStringHandler.AppendFormatted(blobContainerClient); return new InvalidOperationException(defaultInterpolatedStringHandler.ToStringAndClear()); } public static ArgumentException InvalidDateTimeUtc(string dateTime) { return new ArgumentException(dateTime + " must be UTC"); } internal static void VerifyHttpsCustomerProvidedKey(Uri uri, CustomerProvidedKey? customerProvidedKey) { if (customerProvidedKey.HasValue && !string.Equals(uri.Scheme, "https", StringComparison.OrdinalIgnoreCase)) throw new ArgumentException("Cannot use client-provided key without HTTPS."); } internal static void VerifyCpkAndEncryptionScopeNotBothSet(CustomerProvidedKey? customerProvidedKey, string encryptionScope) { if (customerProvidedKey.HasValue && encryptionScope != null) throw new ArgumentException("CustomerProvidedKey and EncryptionScope cannot both be set"); } public static ArgumentException ParsingFullHttpRangeFailed(string range) { return new ArgumentException("Could not obtain the total length from HTTP range " + range); } } }