update message parsing, tests

This commit is contained in:
Timothy Pogue
2022-09-10 14:29:15 -06:00
parent c5d031733b
commit 2afd5c202c
2 changed files with 29 additions and 15 deletions

View File

@@ -264,10 +264,6 @@ class ExternalMessageConsumer:
logger.error(f"Invalid message from `{producer_name}`: {e}")
return
# We shouldn't get empty messages
if producer_message.data is None:
return
logger.info(f"Received message of type `{producer_message.type}` from `{producer_name}`")
message_handler = self._message_handlers.get(producer_message.type)
@@ -282,7 +278,8 @@ class ExternalMessageConsumer:
try:
# Validate the message
message = WSWhitelistMessage.parse_obj(message)
except ValidationError:
except ValidationError as e:
logger.error(f"Invalid message from `{producer_name}`: {e}")
return
# Add the pairlist data to the DataProvider
@@ -293,7 +290,8 @@ class ExternalMessageConsumer:
def _consume_analyzed_df_message(self, producer_name: str, message: Any):
try:
message = WSAnalyzedDFMessage.parse_obj(message)
except ValidationError:
except ValidationError as e:
logger.error(f"Invalid message from `{producer_name}`: {e}")
return
key = message.data.key