Skip to content

REQUEST - User Notification Exception Handling

User notification exception handling is great for scenarios where the user initiates an action, but an issue occurs such as the network failing, data issues, etc. This middleware does the standard try/execute/catch/log & notify user that something went wrong

Usage

To use it on with your request handlers, simply mark them with the UserNotificationAttribute:

public class MyRequestHandler : IRequestHandler<MyRequest>
{
[UserNotify(ErrorTitle = "NOPE", ErrorMessage = "Quit causing issues :)")]
public Task Handle(ErrorRequest request, CancellationToken cancellationToken)
{
throw new InvalidOperationException("Why you call me?");
}
}