Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default traceback not helpful in case of server errors #115

Open
FelixSchwarz opened this issue Dec 4, 2023 · 0 comments
Open

default traceback not helpful in case of server errors #115

FelixSchwarz opened this issue Dec 4, 2023 · 0 comments

Comments

@FelixSchwarz
Copy link

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.

@FelixSchwarz FelixSchwarz changed the title error message not helpful in case of server errors default traceback not helpful in case of server errors Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant