Skip to content

Commit dcad82f

Browse files
committed
Added missing function result adapter
1 parent 5a2870d commit dcad82f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Core/Cleipnir.ResilientFunctions/InnerAdapters/InnerToAsyncResultAdapters.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,21 @@ public static Func<Unit, Workflow, Task<Result<Unit>>> ToInnerParamlessWithTaskR
7070
};
7171
}
7272

73+
public static Func<Unit, Workflow, Task<Result<Unit>>> ToInnerParamlessWithTaskResultReturn(Func<Workflow, Task<Result<Unit>>> inner)
74+
{
75+
return async (_, workflow) =>
76+
{
77+
try
78+
{
79+
var result = await inner(workflow);
80+
return result;
81+
}
82+
catch (PostponeInvocationException exception) { return Postpone.Until(exception.PostponeUntil); }
83+
catch (SuspendInvocationException exception) { return Suspend.While(exception.ExpectedInterruptCount.Value); }
84+
catch (Exception exception) { return Fail.WithException(exception); }
85+
};
86+
}
87+
7388
public static Func<Unit, Workflow, Task<Result<Unit>>> ToInnerParamlessWithTaskResultReturn(Func<Workflow, Task<Result>> inner)
7489
{
7590
return async (_, workflow) =>

0 commit comments

Comments
 (0)