diff --git a/EnvelopeGenerator.Application/Common/Extensions/TaskExtensions.cs b/EnvelopeGenerator.Application/Common/Extensions/TaskExtensions.cs index 7360675c..2fae57ea 100644 --- a/EnvelopeGenerator.Application/Common/Extensions/TaskExtensions.cs +++ b/EnvelopeGenerator.Application/Common/Extensions/TaskExtensions.cs @@ -65,6 +65,19 @@ public static class TaskExtensions /// [Obsolete("Implement Mediator behaviors in the Osolete .NET project.")] public static Task FirstOrDefaultAsync(this Task> task) => task.Then(t => t.FirstOrDefault()); + + /// + /// + /// + /// + /// + /// + /// + /// + [Obsolete("Implement Mediator behaviors in the Osolete .NET project.")] + public static Task FirstAsync(this Task> task, Func factory) + where TException : Exception + => task.Then(t => t.FirstOrDefault()) ?? throw factory(); } ///