Skip to content

Commit

Permalink
(fix) field validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
d3nbr0 committed Dec 5, 2024
1 parent 1403aeb commit a6f6834
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aiocarrot/consumer/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async def on_message(self, _cid: str, _cnm: str, **kwargs) -> None:

value, errors = field.validate(kwargs[field.name])

if not value:
if errors is not None:
logger.error(
f'[{_cid}] Error processing the message <{_cnm}>: field "{field.name}" with value "{kwargs[field.name]}" '
f'does not meet the validation conditions - {str(errors)}',
Expand All @@ -115,8 +115,8 @@ async def on_message(self, _cid: str, _cnm: str, **kwargs) -> None:

try:
await message.handler(**values)
except BaseException:
logger.trace(f'[{_cid}] Message processing failed <{_cnm}>')
except BaseException as e:
logger.error(f'[{_cid}] Message processing failed <{_cnm}>: {str(e)}')
return

logger.info(f'[{_cid}] Message <{_cnm}> processed successfully')
Expand Down

0 comments on commit a6f6834

Please sign in to comment.