| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using System.Globalization; |
| | 6 | |
|
| | 7 | | namespace 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) |
| 0 | 16 | | => new ArgumentException(string.Format( |
| 0 | 17 | | CultureInfo.CurrentCulture, |
| 0 | 18 | | "Account Name Mismatch: {0} != {1}", |
| 0 | 19 | | accountNameCredential, |
| 0 | 20 | | accountNameValue)); |
| | 21 | |
|
| | 22 | | public static InvalidOperationException AccountSasMissingData() |
| 0 | 23 | | => new InvalidOperationException($"Account SAS is missing at least one of these: ExpiryTime, Permissions, Se |
| | 24 | |
|
| | 25 | | public static ArgumentNullException ArgumentNull(string paramName) |
| 0 | 26 | | => new ArgumentNullException(paramName); |
| | 27 | |
|
| | 28 | | public static ArgumentException InvalidResourceType(char s) |
| 0 | 29 | | => new ArgumentException($"Invalid resource type: '{s}'"); |
| | 30 | |
|
| | 31 | | public static InvalidOperationException TaskIncomplete() |
| 0 | 32 | | => new InvalidOperationException("Task is not completed"); |
| | 33 | |
|
| | 34 | | public static FormatException InvalidFormat(string err) |
| 0 | 35 | | => new FormatException(err); |
| | 36 | |
|
| | 37 | | public static ArgumentException ParsingConnectionStringFailed() |
| 0 | 38 | | => new ArgumentException("Connection string parsing error"); |
| | 39 | |
|
| | 40 | | public static ArgumentOutOfRangeException InvalidSasProtocol(string protocol, string sasProtocol) |
| 0 | 41 | | => new ArgumentOutOfRangeException(protocol, $"Invalid {sasProtocol} value"); |
| | 42 | |
|
| | 43 | | public static ArgumentException InvalidService(char s) |
| 0 | 44 | | => new ArgumentException($"Invalid service: '{s}'"); |
| | 45 | |
|
| | 46 | | public static ArgumentException InsufficientStorageTransferOptions(long streamLength, long statedMaxBlockSize, l |
| 0 | 47 | | => new ArgumentException($"Cannot upload {streamLength} bytes with a maximum transfer size of {statedMaxBloc |
| | 48 | | } |
| | 49 | | } |