| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for license information. |
| | 3 | |
|
| | 4 | | namespace Microsoft.Azure.Batch |
| | 5 | | { |
| | 6 | | using System; |
| | 7 | | using System.Threading.Tasks; |
| | 8 | |
|
| | 9 | | /// <summary> |
| | 10 | | /// A <see cref="BatchClientBehavior"/> which specifies how exceptions should be thrown from |
| | 11 | | /// synchronous methods. |
| | 12 | | /// </summary> |
| | 13 | | /// <remarks> |
| | 14 | | /// By default, synchronous methods throw the same exceptions as asynchronous ones. For compatability with versions |
| | 15 | | /// of the Azure.Batch client prior to 4.0, you can specify the <see cref="ThrowAggregateException"/> behavior to wr |
| | 16 | | /// thrown from synchronous methods in an <see cref="AggregateException"/>. |
| | 17 | | /// </remarks> |
| | 18 | | public class SynchronousMethodExceptionBehavior : BatchClientBehavior |
| | 19 | | { |
| | 20 | | /// <summary> |
| | 21 | | /// This behavior causes synchronous methods to throw <see cref="AggregateException"/> on failure. |
| | 22 | | /// </summary> |
| | 23 | | /// <remarks> |
| | 24 | | /// This was the default <see cref="SynchronousMethodExceptionBehavior"/> used by Azure.Batch versions prior to |
| | 25 | | /// </remarks> |
| 1 | 26 | | public static readonly SynchronousMethodExceptionBehavior ThrowAggregateException = new SynchronousMethodExcepti |
| | 27 | |
|
| | 28 | | internal void Wait(Task task) |
| | 29 | | { |
| 2 | 30 | | task.Wait(); |
| 0 | 31 | | } |
| | 32 | |
|
| | 33 | | /// <summary> |
| | 34 | | /// Initializes a new instance of the <see cref="SynchronousMethodExceptionBehavior"/> class. |
| | 35 | | /// </summary> |
| 1 | 36 | | private SynchronousMethodExceptionBehavior() |
| | 37 | | { |
| | 38 | |
|
| 1 | 39 | | } |
| | 40 | | } |
| | 41 | | } |