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

Uninformative exceptions #266

Closed
slavaGanzin opened this issue Aug 31, 2024 · 2 comments · Fixed by #272
Closed

Uninformative exceptions #266

slavaGanzin opened this issue Aug 31, 2024 · 2 comments · Fixed by #272
Labels
bug Something isn't working

Comments

@slavaGanzin
Copy link

Python is usually inferior in properly describing what happened, but your client is a gem.
What the fuck should I understand from your exception?


Traceback (most recent call last):
  File "/Users/slava/work/helpmetest2/robot/listener.py", line 381, in <module>
    bill('MyAwesomeCompany:123233:1q123123')
  File "/Users/slava/work/helpmetest2/robot/helpers.py", line 44, in bill
    client.events.create(Event(
  File "/Users/slava/work/helpmetest2/.venv/lib/python3.12/site-packages/lago_python_client/mixins.py", line 58, in create
    response_data = get_response_data(response=api_response, key=self.ROOT_NAME)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/slava/work/helpmetest2/.venv/lib/python3.12/site-packages/lago_python_client/services/response.py", line 69, in get_response_data
    response_or_None: Optional[Response] = verify_response(response)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/slava/work/helpmetest2/.venv/lib/python3.12/site-packages/lago_python_client/services/response.py", line 53, in verify_response
    raise LagoApiError(
lago_python_client.exceptions.LagoApiError

And plain request gives me an answer:
{'status': 422, 'error': 'Unprocessable Entity', 'code': 'validation_errors', 'error_details': {'transaction_id': ['value_already_exist']}}

@slavaGanzin slavaGanzin added the bug Something isn't working label Aug 31, 2024
@jdenquin
Copy link
Contributor

jdenquin commented Sep 1, 2024

I agree this exception is really bad and does not represent the actual error, we're taking a look at it

@vincent-pochet
Copy link
Contributor

Thank you for reporting this @slavaGanzin
The error management will be improved with the next release of this client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants