From e5b3990f77e5ba003301c862eca8317660c6ac96 Mon Sep 17 00:00:00 2001 From: doomchild Date: Fri, 22 Nov 2024 14:24:04 -0600 Subject: [PATCH] Issue-92: Fix extra wrapping of Filter exceptions closes #92 SemVer:Patch --- src/TaskExtensions.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/TaskExtensions.cs b/src/TaskExtensions.cs index 02b0844..16871b6 100644 --- a/src/TaskExtensions.cs +++ b/src/TaskExtensions.cs @@ -226,7 +226,7 @@ Func> morphism return predicate(result) == true ? Task.FromResult(result) - : morphism(result).ContinueWith(failureTask => Task.FromException(PotentiallyUnwindException(failureTask.Result))).Unwrap(); + : morphism(result).Then(failureTask => Task.FromException(PotentiallyUnwindException(failureTask))); }).Unwrap(); } @@ -280,10 +280,10 @@ Func morphism T predicateValue = continuationTask.Result; return predicate(predicateValue) - .ContinueWith(predicateTask => predicateTask.Result - ? Task.FromResult(predicateValue) - : Task.FromException(PotentiallyUnwindException(morphism(predicateValue))) - ).Unwrap(); + .Then(predicateResult => predicateResult + ? Task.FromResult(predicateValue) + : Task.FromException(PotentiallyUnwindException(morphism(predicateValue))) + ); }).Unwrap(); } @@ -312,7 +312,7 @@ Func> morphism { return predicateTask.Result ? Task.FromResult(continuationValue) - : morphism().ContinueWith(morphismTask => Task.FromException(PotentiallyUnwindException(morphismTask.Result))).Unwrap(); + : morphism().Then(exception => Task.FromException(PotentiallyUnwindException(exception))); }).Unwrap(); }).Unwrap(); } @@ -342,7 +342,7 @@ Func> morphism { return predicateTask.Result ? Task.FromResult(continuationValue) - : morphism(continuationValue).ContinueWith(morphismTask => Task.FromException(PotentiallyUnwindException(morphismTask.Result))).Unwrap(); + : morphism(continuationValue).Then(exception => Task.FromException(PotentiallyUnwindException(exception))); }).Unwrap(); }).Unwrap(); }