Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/Polly.Core/Simmy/Outcomes/ChaosOutcomeStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ protected internal override async ValueTask<Outcome<T>> ExecuteCore<TState>(Func
await _onOutcomeInjected(args).ConfigureAwait(context.ContinueOnCapturedContext);
}

if (outcome.Value.Exception is not null)
if (outcome.HasValue is false)
{
return new Outcome<T>(outcome.Value.Exception);
return new Outcome<T>(default(T?));
}

return new Outcome<T>(outcome.Value.Result);
if (outcome.Value.HasResult)
{
return new Outcome<T>(outcome.Value.Result);
}

return new Outcome<T>(outcome.Value.Exception!);
}

return await StrategyHelper.ExecuteCallbackSafeAsync(callback, context, state).ConfigureAwait(context.ContinueOnCapturedContext);
Expand Down