Skip to content

Commit

Permalink
Rename exception
Browse files Browse the repository at this point in the history
Change to `requestException` per feedback.
  • Loading branch information
martincostello committed Sep 27, 2023
1 parent 7436449 commit b3a027a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions docs/strategies/fallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ Use `ExecuteOutcomeAsync` and then evaluate the `Exception`:
<!-- snippet: fallback-pattern-1 -->
```cs
var outcome = await WhateverPipeline.ExecuteOutcomeAsync(Action, context, "state");
if (outcome.Exception is HttpRequestException httpEx)
if (outcome.Exception is HttpRequestException requestException)
{
throw new CustomNetworkException("Replace thrown exception", httpEx);
throw new CustomNetworkException("Replace thrown exception", requestException);
}
```
<!-- endSnippet -->
Expand All @@ -125,9 +125,9 @@ public static async ValueTask<HttpResponseMessage> Action()
return Outcome.FromResult(result);
}, context, "state");

if (outcome.Exception is HttpRequestException httpEx)
if (outcome.Exception is HttpRequestException requestException)
{
throw new CustomNetworkException("Replace thrown exception", httpEx);
throw new CustomNetworkException("Replace thrown exception", requestException);
}

ResilienceContextPool.Shared.Return(context);
Expand Down
8 changes: 4 additions & 4 deletions src/Snippets/Docs/Fallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public static async Task Pattern_1()
#region fallback-pattern-1

var outcome = await WhateverPipeline.ExecuteOutcomeAsync(Action, context, "state");
if (outcome.Exception is HttpRequestException httpEx)
if (outcome.Exception is HttpRequestException requestException)
{
throw new CustomNetworkException("Replace thrown exception", httpEx);
throw new CustomNetworkException("Replace thrown exception", requestException);
}
#endregion

Expand All @@ -125,9 +125,9 @@ public static async ValueTask<HttpResponseMessage> Action()
return Outcome.FromResult(result);
}, context, "state");

if (outcome.Exception is HttpRequestException httpEx)
if (outcome.Exception is HttpRequestException requestException)
{
throw new CustomNetworkException("Replace thrown exception", httpEx);
throw new CustomNetworkException("Replace thrown exception", requestException);
}

ResilienceContextPool.Shared.Return(context);
Expand Down

0 comments on commit b3a027a

Please sign in to comment.