-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EnsureSuccess for PolicyResult #1238
Comments
@martintmk Is there anything that would essentially fulfil this request in v8? |
There is low-level method in V8 to retrieve the outcome: I think we can add this helper method to Outcome in V8. It will be useful. |
This can be easily done via extension method(s): public static void EnsureSuccess(this PolicyResult result)
{
if (result.Outcome == OutcomeType.Failure)
throw new SomeException(result.FinalException)
}
public static void EnsureSuccess<TResult>(this PolicyResult<TResult> result)
{
if (result.Outcome == OutcomeType.Failure)
throw new SomeException(result.FinalException)
} |
The V8 |
When replacing try/catch block with Polly equivalent one has to manually check the result and make sure there is no exception:
It would be nice to be able to do this instead:
The text was updated successfully, but these errors were encountered: