chargebee / chargebee-python

Python library for the Chargebee API.
https://apidocs.chargebee.com/docs/api?lang=python
MIT License
40 stars 31 forks source link

Fix Exception re-raising in models/events.py #51

Open kbairak opened 2 years ago

kbairak commented 2 years ago

Exceptions do not have message attribute in Python 3.

See PEP-352

Also, and this is my opinion, it doesn't offer any value to re-raise the JSON decode error as something else. I would propose this change too:

-try:
-    webhook_data = json.loads(json_data)
-except (TypeError, ValueError) as ex:
-     raise Exception("The passed json_data is not JSON formatted . {}".format(str(ex)))
+webhook_data = json.loads(json_data)