-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Open
Description
The openapi-generator creates this ExceptionFactory:
Lines 48 to 62 in 150e24d
/// <summary> | |
/// Default creation of exceptions for a given method name and response object | |
/// </summary> | |
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; | |
}; |
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?
mbrookson, RamiSh, robert-hornbachner-primetals-com, valmoz, matt-richardson and 2 more