leonhard-s / auraxium

A high-level Python wrapper for the PlanetSide 2 API.
https://auraxium.readthedocs.io/
MIT License
28 stars 8 forks source link

Improve error message when pydantic validation fails #51

Closed leonhard-s closed 3 years ago

leonhard-s commented 3 years ago

When pydantic encounters an invalid payload, the following exception is raised (example taken from #50):

auraxium\event\_client.py:167> exception=ValidationError(model='MetagameEvent', errors=[{'loc': ('experience_bonus',), 'msg': 'value is not a valid integer', 'type': 'type_error.integer'}])>

This being an error is of no benefit to the user as this is due to a model mismatch in the library and cannot be fixed by the user. Instead, we should ignore these payloads with a warning and ask the user to submit an issue so the model can be fixed.