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 3254c53 commit 6ce1158
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 6ce1158

Please sign in to comment.