OpenAPITools / OpenAPITools/openapi-generator

[BUG] [csharp] DefaultExceptionFactory hides exceptions

Open
#8,732 9 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: C-Sharp Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

The openapi-generator creates this ExceptionFactory:

https://github.com/OpenAPITools/openapi-generator/blob/150e24dc553a8ea5230ffb938ed3e6020e972faa/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/Configuration.cs#L48-L62

First of all, I'm not sure handling response codes as exceptions is good practice, but that could be debated.

However, what's much worse is that real exceptions are hidden - in case a timeout occurs, or the connection is closed etc., all I get is a null response instead of the real exception.

Am I missing something? How are other people handling this?

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 with the linked samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/Configuration.cs around lines 48-62 and trace how generated clients handle transport failures. Determine why timeouts or closed connections result in a null response instead of the underlying exception. Done means the expected exception behavior is defined and verified for the generated C# client.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.