< Summary

Class:Azure.Storage.Errors
Assembly:Azure.Storage.Queues
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Common\src\Shared\Errors.Clients.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Common\src\Shared\Errors.cs
Covered lines:4
Uncovered lines:46
Coverable lines:50
Total lines:167
Line coverage:8% (4 of 50)
Covered branches:2
Total branches:4
Branch coverage:50% (2 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
CannotBothBeNotNull(...)-0%100%
InvalidArgument(...)-0%100%
MustBeGreaterThanOrEqualTo(...)-0%100%
MustBeLessThanOrEqualTo(...)-0%100%
MustBeBetweenInclusive(...)-0%100%
MustBeGreaterThanValueOrEqualToOtherValue(...)-0%100%
StreamMustBeReadable(...)-0%100%
StreamMustBeAtPosition0()-0%100%
TokenCredentialsRequireHttps()-0%100%
SasMissingData(...)-0%100%
SasDataNotAllowed(...)-0%100%
InvalidPermission(...)-0%100%
ParsingHttpRangeFailed()-0%100%
UnableAccessArray()-0%100%
NotImplemented()-0%100%
InvalidCredentials(...)-0%100%
SeekOutsideBufferRange(...)-0%100%
VersionNotSupported(...)-0%100%
ClientRequestIdMismatch(...)-0%100%
VerifyHttpsTokenAuth(...)-100%100%
ClientSideEncryptionVersionNotSupported(...)-0%0%
TypeNotSupported(...)-0%100%
MissingRequiredEncryptionResources(...)-0%100%
KeyNotFound(...)-0%100%
BadEncryptionAgent(...)-0%100%
BadEncryptionAlgorithm(...)-0%100%
MissingEncryptionMetadata(...)-0%100%
AccountMismatch(...)-0%100%
AccountSasMissingData()-0%100%
ArgumentNull(...)-100%100%
InvalidResourceType(...)-0%100%
TaskIncomplete()-0%100%
InvalidFormat(...)-0%100%
ParsingConnectionStringFailed()-0%100%
InvalidSasProtocol(...)-0%100%
InvalidService(...)-0%100%
InsufficientStorageTransferOptions(...)-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Common\src\Shared\Errors.Clients.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Globalization;
 6using System.Linq;
 7using System.Security.Authentication;
 8using Azure.Core.Pipeline;
 9
 10namespace Azure.Storage
 11{
 12    // These error messages are only used by client libraries and not by the common
 13    internal partial class Errors
 14    {
 15        public static ArgumentException CannotBothBeNotNull(string param0, string param1)
 016            => new ArgumentException($"{param0} and {param1} cannot both be set");
 17
 18        public static ArgumentException InvalidArgument(string paramName)
 019            => new ArgumentException($"{paramName} is invalid");
 20
 21        public static ArgumentOutOfRangeException MustBeGreaterThanOrEqualTo(string paramName, long value)
 022            => new ArgumentOutOfRangeException(paramName, $"Value must be greater than or equal to {value}");
 23
 24        public static ArgumentOutOfRangeException MustBeLessThanOrEqualTo(string paramName, long value)
 025            => new ArgumentOutOfRangeException(paramName, $"Value must be less than or equal to {value}");
 26
 27        public static ArgumentOutOfRangeException MustBeBetweenInclusive(
 28                string paramName,
 29                long lower,
 30                long upper,
 31                long actual)
 032            => new ArgumentOutOfRangeException(paramName, $"Value must be between {lower} and {upper} inclusive, not {ac
 33
 34        public static ArgumentOutOfRangeException MustBeGreaterThanValueOrEqualToOtherValue(
 35                string paramName,
 36                long value0,
 37                long value1)
 038            => new ArgumentOutOfRangeException(paramName, $"Value must be greater than {value0} or equal to {value1}");
 39
 40        public static ArgumentException StreamMustBeReadable(string paramName)
 041            => new ArgumentException("Stream must be readable", paramName);
 42
 43        public static InvalidOperationException StreamMustBeAtPosition0()
 044            => new InvalidOperationException("Stream must be set to position 0");
 45
 46        public static InvalidOperationException TokenCredentialsRequireHttps()
 047            => new InvalidOperationException("Use of token credentials requires HTTPS");
 48
 49        public static InvalidOperationException SasMissingData(string paramName)
 050            => new InvalidOperationException($"SAS is missing required parameter: {paramName}");
 51
 52        public static InvalidOperationException SasDataNotAllowed(string paramName, string paramNameNotAllowed)
 053            => new InvalidOperationException($"SAS cannot have the {paramNameNotAllowed} parameter when the {paramName} 
 54
 55        public static ArgumentException InvalidPermission(char s)
 056            => new ArgumentException($"Invalid permission: '{s}'");
 57
 58        public static ArgumentException ParsingHttpRangeFailed()
 059            => new ArgumentException("Could not parse the serialized range.");
 60
 61        public static AccessViolationException UnableAccessArray()
 062            => new AccessViolationException("Unable to get array from memory pool");
 63
 64        public static NotImplementedException NotImplemented()
 065            => new NotImplementedException();
 66
 67        public static AuthenticationException InvalidCredentials(string fullName)
 068            => new AuthenticationException($"Cannot authenticate credentials with {fullName}");
 69
 70        public static ArgumentException SeekOutsideBufferRange(long index, long inclusiveRangeStart, long exclusiveRange
 071            => new ArgumentException($"Tried to seek ouside buffer range. Gave index {index}, range is [{inclusiveRangeS
 72
 73        public static ArgumentException VersionNotSupported(string paramName)
 074            => new ArgumentException($"The version specified by {paramName} is not supported by this library.");
 75
 76        public static RequestFailedException ClientRequestIdMismatch(ClientDiagnostics clientDiagnostics, Response respo
 077            => clientDiagnostics.CreateRequestFailedExceptionWithContent(
 078                response,
 079                $"Response x-ms-client-request-id '{echo}' does not match the original expected request id, '{original}'
 80
 81        public static void VerifyHttpsTokenAuth(Uri uri)
 82        {
 1283            if (uri.Scheme != Constants.Https)
 84            {
 885                throw new ArgumentException("Cannot use TokenCredential without HTTPS.");
 86            }
 487        }
 88
 89        public static class ClientSideEncryption
 90        {
 91            public static InvalidOperationException ClientSideEncryptionVersionNotSupported(string versionString = defau
 092                => new InvalidOperationException("This library does not support the given version of client-side encrypt
 093                    versionString == default ? "" : $" Version ID = {versionString}");
 94
 95            public static InvalidOperationException TypeNotSupported(Type type)
 096                => new InvalidOperationException(
 097                    $"Client-side encryption is not supported for type \"{type.FullName}\". " +
 098                    "Please use a supported client type or create this client without specifying client-side encryption 
 99
 100            public static InvalidOperationException MissingRequiredEncryptionResources(params string[] resourceNames)
 0101                => new InvalidOperationException("Cannot encrypt without specifying " + string.Join(",", resourceNames.A
 102
 103            public static ArgumentException KeyNotFound(string keyId)
 0104            => new ArgumentException($"Resolution of id {keyId} returned null.");
 105
 106            public static ArgumentException BadEncryptionAgent(string agent)
 0107                => new ArgumentException("Invalid Encryption Agent. This version of the client library does not understa
 0108                    $"the Encryption Agent protocol \"{agent}\" set on the blob.");
 109
 110            public static ArgumentException BadEncryptionAlgorithm(string algorithm)
 0111                => new ArgumentException($"Invalid Encryption Algorithm \"{algorithm}\" found on the resource. This vers
 0112                    "library does not support the given encryption algorithm.");
 113
 114            public static InvalidOperationException MissingEncryptionMetadata(string field)
 0115                => new InvalidOperationException($"Missing field \"{field}\" in encryption metadata");
 116        }
 117    }
 118}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Common\src\Shared\Errors.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Globalization;
 6
 7namespace Azure.Storage
 8{
 9
 10    /// <summary>
 11    /// Create exceptions for common error cases.
 12    /// </summary>
 13    internal partial class Errors
 14    {
 15        public static ArgumentException AccountMismatch(string accountNameCredential, string accountNameValue)
 016            => new ArgumentException(string.Format(
 017                CultureInfo.CurrentCulture,
 018                "Account Name Mismatch: {0} != {1}",
 019                accountNameCredential,
 020                accountNameValue));
 21
 22        public static InvalidOperationException AccountSasMissingData()
 023            => new InvalidOperationException($"Account SAS is missing at least one of these: ExpiryTime, Permissions, Se
 24
 25        public static ArgumentNullException ArgumentNull(string paramName)
 426            => new ArgumentNullException(paramName);
 27
 28        public static ArgumentException InvalidResourceType(char s)
 029            => new ArgumentException($"Invalid resource type: '{s}'");
 30
 31        public static InvalidOperationException TaskIncomplete()
 032            => new InvalidOperationException("Task is not completed");
 33
 34        public static FormatException InvalidFormat(string err)
 035            => new FormatException(err);
 36
 37        public static ArgumentException ParsingConnectionStringFailed()
 038            => new ArgumentException("Connection string parsing error");
 39
 40        public static ArgumentOutOfRangeException InvalidSasProtocol(string protocol, string sasProtocol)
 041            => new ArgumentOutOfRangeException(protocol, $"Invalid {sasProtocol} value");
 42
 43        public static ArgumentException InvalidService(char s)
 044            => new ArgumentException($"Invalid service: '{s}'");
 45
 46        public static ArgumentException InsufficientStorageTransferOptions(long streamLength, long statedMaxBlockSize, l
 047            => new ArgumentException($"Cannot upload {streamLength} bytes with a maximum transfer size of {statedMaxBloc
 48    }
 49}