You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Response body is missing from custom exception message #22351
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When using the API client and encountering an exception, the user sees
E ...exceptions.ServiceException: (500)
E Reason: Internal Server Error
E HTTP response headers: HTTPHeaderDict(...)
E HTTP response body: error=None
This is unfortunate, as the useful response body of the exception is "overriden" by the not-useful response data "error=None"
openapi-generator version
7.14.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Create a call against a client which produces e.g. a 500 error, with an http response containing response data, and a useful response body. The useful response body will be missing from the exception str.
I found it a bit hard to describe the issue in words, but looking at the code the issue (and fix!) is relatively straightforward.
modules/openapi-generator/src/main/resources/python/exceptions.mustache
...
if self.data or self.body:
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
Note that the response body may get "overriden" by the response data, which is unfortunate in cases where the repsonse body contains very useful logs.
Activity
ddl-rliu commentedon Nov 14, 2025
I found it a bit hard to describe the issue in words, but looking at the code the issue (and fix!) is relatively straightforward.
Note that the response body may get "overriden" by the response data, which is unfortunate in cases where the repsonse body contains very useful logs.
[BUG] Fix OpenAPITools#22351 by updating exceptions.mustache to log b…
[BUG] Fix OpenAPITools#22351 by updating exceptions.mustache to log b…