getlago / lago-python-client

Python wrapper for the Lago Rest API
MIT License
20 stars 10 forks source link

fix: Improve LagoApiError details #272

Closed vincent-pochet closed 1 week ago

vincent-pochet commented 1 week ago

This PR fixes https://github.com/getlago/lago-python-client/issues/266

It makes sure that LagoApiError shows a comprehensible message in the output. It will render the API response, allowing user to quickly understand the source of the error.

Before

lago_python_client.exceptions.LagoApiError

After

lago_python_client.exceptions.LagoApiError: {'status': 422, 'error': 'Unprocessable Entity', 'code': 'validation_errors', 'error_details': {'transaction_id': ['value_already_exist']}}