Skip to content

Commit 547eee1

Browse files
authored
[BUG] Fix #22351 by updating exceptions.mustache to log both the response data and response body, when applicable (#22352)
* Update exceptions.mustache * Add autogen files
1 parent c1c74c0 commit 547eee1

File tree

7 files changed

+35
-14
lines changed

7 files changed

+35
-14
lines changed

modules/openapi-generator/src/main/resources/python/exceptions.mustache

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,11 @@ class ApiException(OpenApiException):
160160
error_message += "HTTP response headers: {0}\n".format(
161161
self.headers)
162162

163-
if self.data or self.body:
164-
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
163+
if self.body:
164+
error_message += "HTTP response body: {0}\n".format(self.body)
165+
166+
if self.data:
167+
error_message += "HTTP response data: {0}\n".format(self.data)
165168

166169
return error_message
167170

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/exceptions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,11 @@ def __str__(self):
170170
error_message += "HTTP response headers: {0}\n".format(
171171
self.headers)
172172

173-
if self.data or self.body:
174-
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
173+
if self.body:
174+
error_message += "HTTP response body: {0}\n".format(self.body)
175+
176+
if self.data:
177+
error_message += "HTTP response data: {0}\n".format(self.data)
175178

176179
return error_message
177180

samples/client/echo_api/python/openapi_client/exceptions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,11 @@ def __str__(self):
170170
error_message += "HTTP response headers: {0}\n".format(
171171
self.headers)
172172

173-
if self.data or self.body:
174-
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
173+
if self.body:
174+
error_message += "HTTP response body: {0}\n".format(self.body)
175+
176+
if self.data:
177+
error_message += "HTTP response data: {0}\n".format(self.data)
175178

176179
return error_message
177180

samples/openapi3/client/petstore/python-aiohttp/petstore_api/exceptions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ def __str__(self):
169169
error_message += "HTTP response headers: {0}\n".format(
170170
self.headers)
171171

172-
if self.data or self.body:
173-
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
172+
if self.body:
173+
error_message += "HTTP response body: {0}\n".format(self.body)
174+
175+
if self.data:
176+
error_message += "HTTP response data: {0}\n".format(self.data)
174177

175178
return error_message
176179

samples/openapi3/client/petstore/python-httpx/petstore_api/exceptions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ def __str__(self):
169169
error_message += "HTTP response headers: {0}\n".format(
170170
self.headers)
171171

172-
if self.data or self.body:
173-
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
172+
if self.body:
173+
error_message += "HTTP response body: {0}\n".format(self.body)
174+
175+
if self.data:
176+
error_message += "HTTP response data: {0}\n".format(self.data)
174177

175178
return error_message
176179

samples/openapi3/client/petstore/python-lazyImports/petstore_api/exceptions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ def __str__(self):
169169
error_message += "HTTP response headers: {0}\n".format(
170170
self.headers)
171171

172-
if self.data or self.body:
173-
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
172+
if self.body:
173+
error_message += "HTTP response body: {0}\n".format(self.body)
174+
175+
if self.data:
176+
error_message += "HTTP response data: {0}\n".format(self.data)
174177

175178
return error_message
176179

samples/openapi3/client/petstore/python/petstore_api/exceptions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ def __str__(self):
169169
error_message += "HTTP response headers: {0}\n".format(
170170
self.headers)
171171

172-
if self.data or self.body:
173-
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
172+
if self.body:
173+
error_message += "HTTP response body: {0}\n".format(self.body)
174+
175+
if self.data:
176+
error_message += "HTTP response data: {0}\n".format(self.data)
174177

175178
return error_message
176179

0 commit comments

Comments
 (0)