svix / svix-webhooks

The enterprise-ready webhooks service 🦀
https://www.svix.com
MIT License
2.33k stars 161 forks source link

Better error messages (python sdk) #1459

Open blakew opened 1 week ago

blakew commented 1 week ago

Feature Request

Motivation

It's difficult to debug error messages using the python sdk

ex:

>>> endpoint_out = await svix.endpoint.create(appid,EndpointIn(**svix_endpoint_args,secret=secret))
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.10/3.10.11/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/__main__.py", line 58, in runcode
    return future.result()
  File "/usr/local/Cellar/python@3.10/3.10.11/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/local/Cellar/python@3.10/3.10.11/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "<console>", line 1, in <module>
  File "/Users/blakewillmarth/faraday/fdy/workers/model_train/.venv/lib/python3.10/site-packages/svix/api.py", line 464, in create
    return await v1_endpoint_create.request_asyncio(
  File "/Users/blakewillmarth/faraday/fdy/workers/model_train/.venv/lib/python3.10/site-packages/svix/internal/openapi_client/api/endpoint/v1_endpoint_create.py", line 240, in request_asyncio
    await request_asyncio_detailed(
  File "/Users/blakewillmarth/faraday/fdy/workers/model_train/.venv/lib/python3.10/site-packages/svix/internal/openapi_client/api/endpoint/v1_endpoint_create.py", line 210, in request_asyncio_detailed
    return _build_response(client=client, response=response)
  File "/Users/blakewillmarth/faraday/fdy/workers/model_train/.venv/lib/python3.10/site-packages/svix/internal/openapi_client/api/endpoint/v1_endpoint_create.py", line 73, in _build_response
    parsed=_parse_response(client=client, response=response),
  File "/Users/blakewillmarth/faraday/fdy/workers/model_train/.venv/lib/python3.10/site-packages/svix/internal/openapi_client/api/endpoint/v1_endpoint_create.py", line 62, in _parse_response
    raise HTTPValidationError.init_exception(response.json(), response.status_code)
svix.internal.openapi_client.models.http_validation_error.HTTPValidationError

Proposal

It would be nice to get detail about the validation error in the error message.

Alternatives

tasn commented 3 days ago

I'm with you, thanks for reporting!