Common: Use isinstance in PydanticEventSerializer

This commit is contained in:
Ilija Lazoroski 2022-09-13 14:09:54 +02:00
parent 6c0b63aa29
commit d3a4f255f0
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class PydanticEventSerializer(IEventSerializer, Generic[T]):
self._event_class = event_class self._event_class = event_class
def serialize(self, event: T) -> JSONSerializable: def serialize(self, event: T) -> JSONSerializable:
if not issubclass(event.__class__, self._event_class): if not isinstance(event, self._event_class):
raise TypeError(f"Event object must be of type: {self._event_class.__name__}") raise TypeError(f"Event object must be of type: {self._event_class.__name__}")
return event.dict(simplify=True) return event.dict(simplify=True)