Class UnhandledExceptionBehavior<TRequest, TResponse>
For any exception that thrown in the request pipeline, except DomainExceptions, by adding this behavior, it will log the exception.
Implements
IPipelineBehavior <TRequest, TResponse>
Inherited Members
Namespace: Code.Library.Application.Behaviors
Assembly: Code.Library.Application.dll
Syntax
public class UnhandledExceptionBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : IRequest<TResponse>
Type Parameters
| Name | Description |
|---|---|
| TRequest | |
| TResponse |
Remarks
Constructors
| Improve this Doc View SourceUnhandledExceptionBehavior(ILogger<TRequest>)
For any exception that thrown in the request pipeline, except DomainExceptions, by adding this behavior, it will log the exception.
Declaration
public UnhandledExceptionBehavior(ILogger<TRequest> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger<TRequest> | logger |
Remarks
Methods
| Improve this Doc View SourceHandle(TRequest, CancellationToken, RequestHandlerDelegate<TResponse>)
For any exception that thrown in the request pipeline, except DomainExceptions, by adding this behavior, it will log the exception.
Declaration
public Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
Parameters
| Type | Name | Description |
|---|---|---|
| TRequest | request | |
| Cancellation |
cancellationToken | |
| Request |
next |
Returns
| Type | Description |
|---|---|
| Task<TResponse> |
Remarks
Implements
MediatR.IPipelineBehavior<TRequest, TResponse>