OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
Generated code in csharp netstandard2.0 is missing check for 0 status code (connection error)
samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/Configuration.cs
click here to jump to the Configuration.cs
public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) =>
{
var status = (int)response.StatusCode;
if (status >= 400)
{
return new ApiException(status,
string.Format("Error calling {0}: {1}", methodName, response.Content),
response.Content);
}
return null;
};
Currently when there is a connection error - the response is null. This is bad because of missing logs and stacktrace.
Technically I could wrap it up or use generated {methodName}WithHttpInfoAsync and manually check the status code.
Downside - I would need to do it every time I'm using the generated code (for me its multiple apps * multiple methods)
Generated code in csharp netstandard2.0 is missing check for 0 status code (connection error) samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/Configuration.cs click here to jump to the Configuration.cs
Currently when there is a connection error - the response is
null
. This is bad because of missing logs and stacktrace. Technically I could wrap it up or use generated{methodName}WithHttpInfoAsync
and manually check the status code. Downside - I would need to do it every time I'm using the generated code (for me its multiple apps * multiple methods)