-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
If the server responds with a non-200 response, openapi3 produces an exception which is not really helpful. It would be nice if the default traceback contained the server response body (in this case "Request body must not be empty")
Traceback (most recent call last):
File "client.py", line 33, in <module>
result = api.call_post_greeting(parameters={'name': 'foo'})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "…/venv/lib64/python3.12/site-packages/openapi3/openapi.py", line 256, in __call__
return self.operation(self.base_url, *args, security=self.security, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "…/venv/lib64/python3.12/site-packages/openapi3/paths.py", line 359, in request
raise UnexpectedResponseError(result, self)
openapi3.errors.UnexpectedResponseError: Unexpected response 400 from post_greeting (expected one of 200, no default is defined)
str(exc) returns UnexpectedResponseError('Unexpected response 400 from post_greeting (expected one of 200, no default is defined)') so that would be nice to see also for uncaught exceptions.
Metadata
Metadata
Assignees
Labels
No labels