forked from p15670423/monkey
Common: Use isinstance in PydanticEventSerializer
This commit is contained in:
parent
6c0b63aa29
commit
d3a4f255f0
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue