From aaa2891f6cd5afa158a189a8985354d3cf9bc6a1 Mon Sep 17 00:00:00 2001 From: Leonhard S Date: Sat, 15 May 2021 11:35:47 +0200 Subject: [PATCH] Warn about bad API payloads These currently still result in an error, but they will also log the full offending payload to facilitate troubleshooting. --- auraxium/base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/auraxium/base.py b/auraxium/base.py index 76181a9..36875c5 100644 --- a/auraxium/base.py +++ b/auraxium/base.py @@ -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