Class ErrorHandlingBehaviour<TMessage>
A generic error handling behaviour that logs any unhandled exceptions before rethrowing them.
Implements
IPipelineBehavior<TMessage>
Inherited Members
Namespace: Chapar.Pipeline.Behaviours
Assembly: Chapar.Pipeline.dll
Syntax
public class ErrorHandlingBehaviour<TMessage> : IPipelineBehavior<TMessage> where TMessage : IMessage
Type Parameters
| Name | Description |
|---|---|
| TMessage |
Constructors
| Edit this page View SourceErrorHandlingBehaviour(ILogger<ErrorHandlingBehaviour<TMessage>>)
Declaration
public ErrorHandlingBehaviour(ILogger<ErrorHandlingBehaviour<TMessage>> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger<ErrorHandlingBehaviour<TMessage>> | logger |
Methods
| Edit this page View SourceHandleAsync(TMessage, Func<Task>, CancellationToken)
Executes the behaviour and optionally calls the next delegate in the pipeline.
Declaration
public Task HandleAsync(TMessage message, Func<Task> next, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| TMessage | message | The message to process. |
| Func<Task> | next | A delegate representing the next action in the pipeline. |
| CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task |