| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 3 | | // license information. |
| | 4 | |
|
| | 5 | | namespace Microsoft.Rest.Azure |
| | 6 | | { |
| | 7 | | using System.Net; |
| | 8 | |
|
| | 9 | | /// <summary> |
| | 10 | | /// Defines extension methods for the CloudException class. |
| | 11 | | /// </summary> |
| | 12 | | public static class CloudExceptionExtensions |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// Indicates whether the exception is the result of a failed access condition (ETag) check. |
| | 16 | | /// </summary> |
| | 17 | | /// <param name="exception">The exception to check.</param> |
| | 18 | | /// <returns>true if the exception is a failed access condition (HTTP 412 Precondition Failed), false otherwise. |
| | 19 | | public static bool IsAccessConditionFailed(this CloudException exception) => |
| 40 | 20 | | exception?.Response?.StatusCode == HttpStatusCode.PreconditionFailed; |
| | 21 | | } |
| | 22 | | } |