Skip to content

Commit

Permalink
Fix: Pydantic 2 handle differently the errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonyjin committed Nov 12, 2024
1 parent 6acdc3c commit c1bdd96
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/aleph/vm/orchestrator/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import aiohttp
import pydantic
from pydantic import ValidationError
from aiohttp import web
from aleph_message.models import (
AlephMessage,
Expand Down Expand Up @@ -73,10 +74,10 @@ async def subscribe_via_ws(url) -> AsyncIterable[AlephMessage]:

try:
yield parse_message(data)
except pydantic.error_wrappers.ValidationError as error:
except pydantic.ValidationError as error:
item_hash = data.get("item_hash", "ITEM_HASH_NOT_FOUND")
logger.warning(
f"Invalid Aleph message: {item_hash} \n {error.model_dump_json()}\n {error.raw_errors}",
f"Invalid Aleph message: {item_hash} \n {error.errors}",
exc_info=False,
)
continue
Expand Down

0 comments on commit c1bdd96

Please sign in to comment.