Skip to content

Commit

Permalink
Merge pull request #93 from doomchild/bugfix/issue-92
Browse files Browse the repository at this point in the history
Issue-92: Fix extra wrapping of Filter exceptions
  • Loading branch information
doomchild authored Nov 22, 2024
2 parents 5a6a8b3 + e5b3990 commit 80cb366
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/TaskExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Func<T, Task<E>> morphism

return predicate(result) == true
? Task.FromResult(result)
: morphism(result).ContinueWith(failureTask => Task.FromException<T>(PotentiallyUnwindException(failureTask.Result))).Unwrap();
: morphism(result).Then(failureTask => Task.FromException<T>(PotentiallyUnwindException(failureTask)));
}).Unwrap();
}

Expand Down Expand Up @@ -280,10 +280,10 @@ Func<T, Exception> morphism
T predicateValue = continuationTask.Result;

return predicate(predicateValue)
.ContinueWith(predicateTask => predicateTask.Result
? Task.FromResult(predicateValue)
: Task.FromException<T>(PotentiallyUnwindException(morphism(predicateValue)))
).Unwrap();
.Then(predicateResult => predicateResult
? Task.FromResult(predicateValue)
: Task.FromException<T>(PotentiallyUnwindException(morphism(predicateValue)))
);
}).Unwrap();
}

Expand Down Expand Up @@ -312,7 +312,7 @@ Func<Task<E>> morphism
{
return predicateTask.Result
? Task.FromResult(continuationValue)
: morphism().ContinueWith(morphismTask => Task.FromException<T>(PotentiallyUnwindException(morphismTask.Result))).Unwrap();
: morphism().Then(exception => Task.FromException<T>(PotentiallyUnwindException(exception)));
}).Unwrap();
}).Unwrap();
}
Expand Down Expand Up @@ -342,7 +342,7 @@ Func<T, Task<E>> morphism
{
return predicateTask.Result
? Task.FromResult(continuationValue)
: morphism(continuationValue).ContinueWith(morphismTask => Task.FromException<T>(PotentiallyUnwindException(morphismTask.Result))).Unwrap();
: morphism(continuationValue).Then(exception => Task.FromException<T>(PotentiallyUnwindException(exception)));
}).Unwrap();
}).Unwrap();
}
Expand Down

0 comments on commit 80cb366

Please sign in to comment.