| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Threading; |
| | | 6 | | using Azure.Core; |
| | | 7 | | |
| | | 8 | | namespace Azure.Messaging.EventHubs.Processor |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Contains information about a partition whose processing threw an exception, as well as |
| | | 12 | | /// the exception that has been thrown. |
| | | 13 | | /// </summary> |
| | | 14 | | /// |
| | | 15 | | /// <seealso href="https://www.nuget.org/packages/Azure.Messaging.EventHubs.Processor" /> |
| | | 16 | | /// |
| | | 17 | | public struct ProcessErrorEventArgs |
| | | 18 | | { |
| | | 19 | | /// <summary> |
| | | 20 | | /// The identifier of the partition whose processing threw an exception. |
| | | 21 | | /// </summary> |
| | | 22 | | /// |
| | 0 | 23 | | public string PartitionId { get; } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// A short description of the operation that was being performed when the exception was thrown. |
| | | 27 | | /// </summary> |
| | | 28 | | /// |
| | 0 | 29 | | public string Operation { get; } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// The exception that was thrown by the <c>EventProcessorClient</c>. |
| | | 33 | | /// </summary> |
| | | 34 | | /// |
| | 0 | 35 | | public Exception Exception { get; } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// A <see cref="CancellationToken"/> instance to signal the request to cancel the operation. |
| | | 39 | | /// </summary> |
| | | 40 | | /// |
| | 0 | 41 | | public CancellationToken CancellationToken { get; } |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// Initializes a new instance of the <see cref="ProcessErrorEventArgs"/> structure. |
| | | 45 | | /// </summary> |
| | | 46 | | /// |
| | | 47 | | /// <param name="partitionId">The identifier of the partition whose processing threw an exception.</param> |
| | | 48 | | /// <param name="operation">A short description of the operation that was being performed when the exception was |
| | | 49 | | /// <param name="exception">The exception that was thrown by the <c>EventProcessorClient</c>.</param> |
| | | 50 | | /// <param name="cancellationToken">A <see cref="CancellationToken"/> instance to signal the request to cancel t |
| | | 51 | | /// |
| | | 52 | | public ProcessErrorEventArgs(string partitionId, |
| | | 53 | | string operation, |
| | | 54 | | Exception exception, |
| | | 55 | | CancellationToken cancellationToken = default) |
| | | 56 | | { |
| | 0 | 57 | | Argument.AssertNotNull(operation, nameof(operation)); |
| | 0 | 58 | | Argument.AssertNotNull(exception, nameof(exception)); |
| | | 59 | | |
| | 0 | 60 | | PartitionId = partitionId; |
| | 0 | 61 | | Operation = operation; |
| | 0 | 62 | | Exception = exception; |
| | 0 | 63 | | CancellationToken = cancellationToken; |
| | 0 | 64 | | } |
| | | 65 | | } |
| | | 66 | | } |