OpenAPITools / OpenAPITools/openapi-generator

[REQ] csharp-netcore apiclient policy result error message

Open
#11,232 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

When using a RetryPolicy if the outcome of the PolicyResult is unsuccessful, a RestResponse object where only the property ErrorException is populated. However in the subsequent code, this property is never accessed, only the property ErrorMessage is used.

Describe the solution you'd like

Replacing the line
ErrorException = policyResult.FinalException
by the line
ErrorMessage = policyResult.FinalException?.Message ?? policyResult.FinalHandledResult.ErrorMessage
or something alike would be great.

This occurs in two methods:

  • private ApiResponse Exec
  • private async Task<ApiResponse> ExecAsync

Additional context

This is a screenshot of the relevant code in the ApiClient.cs file.
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ApiClient.cs and inspect the private Exec and ExecAsync methods where RetryPolicy results populate RestResponse. Ensure an unsuccessful policy result exposes the final exception or handled result through ErrorMessage in both methods, then verify the generated csharp-netcore client behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.