From e7fad97568ce89d9b9da38279fa5efe0b0822f12 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 4 May 2026 14:53:58 +0800 Subject: [PATCH] update C# samples with throwOnAnyError enabled --- .../csharp-restsharp-net4.7-multipleFrameworks.yaml | 1 + .../src/Org.OpenAPITools/Client/ApiClient.cs | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/configs/csharp-restsharp-net4.7-multipleFrameworks.yaml b/bin/configs/csharp-restsharp-net4.7-multipleFrameworks.yaml index b53220d0dbf8..c1e5c4ed574b 100644 --- a/bin/configs/csharp-restsharp-net4.7-multipleFrameworks.yaml +++ b/bin/configs/csharp-restsharp-net4.7-multipleFrameworks.yaml @@ -8,3 +8,4 @@ additionalProperties: targetFramework: netstandard2.1;net47 useCompareNetObjects: "true" equatable: true + throwOnAnyError: true diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs index 879b06b7645b..029798be3ae0 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs @@ -468,7 +468,8 @@ private async Task> ExecClientAsync(Func> DeserializeRestResponseFromPolicyAsync(Re } else { - return new RestResponse(request) - { - ErrorException = policyResult.FinalException - }; + throw policyResult.FinalException ?? new InvalidOperationException("The retry policy failed without an exception."); } }