[python-experimental] Fix error message (#13471)

* fix error message formatting

* add more infos in error message
This commit is contained in:
Elton H.Y. Chou
2022-09-20 06:40:53 +08:00
committed by GitHub
parent 54e712a424
commit 4a2845152d
3 changed files with 6 additions and 6 deletions

View File

@@ -915,8 +915,8 @@ class OpenApiResponse(JSONDetector):
if self.content is not None:
if content_type not in self.content:
raise ApiValueError(
f'Invalid content_type={content_type} returned for response with '
'status_code={str(response.status)}'
f"Invalid content_type returned. Content_type='{content_type}' was returned "
f"when only {str(set(self.content))} are defined for status_code={str(response.status)}"
)
body_schema = self.content[content_type].schema
if body_schema is None:

View File

@@ -919,8 +919,8 @@ class OpenApiResponse(JSONDetector):
if self.content is not None:
if content_type not in self.content:
raise ApiValueError(
f'Invalid content_type={content_type} returned for response with '
'status_code={str(response.status)}'
f"Invalid content_type returned. Content_type='{content_type}' was returned "
f"when only {str(set(self.content))} are defined for status_code={str(response.status)}"
)
body_schema = self.content[content_type].schema
if body_schema is None:

View File

@@ -919,8 +919,8 @@ class OpenApiResponse(JSONDetector):
if self.content is not None:
if content_type not in self.content:
raise ApiValueError(
f'Invalid content_type={content_type} returned for response with '
'status_code={str(response.status)}'
f"Invalid content_type returned. Content_type='{content_type}' was returned "
f"when only {str(set(self.content))} are defined for status_code={str(response.status)}"
)
body_schema = self.content[content_type].schema
if body_schema is None: