Skip to content

Commit

Permalink
Warn about bad API payloads
Browse files Browse the repository at this point in the history
These currently still result in an error, but they will also log the full offending payload to facilitate troubleshooting.
  • Loading branch information
leonhard-s committed May 15, 2021
1 parent 2e05a64 commit aaa2891
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions auraxium/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ def __init__(self, data: CensusData, client: RequestClient) -> None:
try:
self.data = self._model(**data)
except pydantic.ValidationError as err:
_log.warning(
'Encountered unsupported payload: %s\n'
'This message means that the Auraxium data model must '
'be updated. Please ensure you are on the latest '
'version of the Auraxium library and report this '
'message to the project maintainers.', data)
raise PayloadError(
f'Unable to instantiate {self.__class__.__name__} instance '
f'from given payload: {err}', data) from err
Expand Down

0 comments on commit aaa2891

Please sign in to comment.