Interface IRequestExceptionHandler<TRequest, TResponse, TException>
Handles an exception of type TException (or a derived type) thrown while handling
TRequest. Call SetHandled(TResponse)
to swallow the exception and supply a fallback response; otherwise the exception is rethrown.
public interface IRequestExceptionHandler<in TRequest, TResponse, in TException> where TRequest : notnull where TException : Exception
Type Parameters
TRequestThe request type.
TResponseThe response type.
TExceptionThe exception type.
Methods
Handle(TRequest, TException, RequestExceptionHandlerState<TResponse>, CancellationToken)
Handles the exception.
Task Handle(TRequest request, TException exception, RequestExceptionHandlerState<TResponse> state, CancellationToken cancellationToken)
Parameters
requestTRequestThe request that failed.
exceptionTExceptionThe exception.
stateRequestExceptionHandlerState<TResponse>State used to mark the exception as handled and provide a response.
cancellationTokenCancellationTokenCancellation token.