Skip to content

Commit a8e84ba

Browse files
committed
add check consumer field type
1 parent d4f7667 commit a8e84ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ydb/_topic_reader/topic_reader.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class PublicReaderSettings:
5454
update_token_interval: Union[int, float] = 3600
5555

5656
def _init_message(self) -> StreamReadMessage.InitRequest:
57+
if not isinstance(self.consumer, str):
58+
raise TypeError("Unsupported type for customer field: '%s'" % type(self.consumer))
59+
5760
if isinstance(self.topic, list):
5861
selectors = self.topic
5962
else:
@@ -65,7 +68,7 @@ def _init_message(self) -> StreamReadMessage.InitRequest:
6568
elif isinstance(selector, PublicTopicSelector):
6669
pass
6770
else:
68-
raise TypeError("Value of %s not supported as topic selector" % type(selector))
71+
raise TypeError("Unsupported type for topic field: '%s'" % type(selector))
6972

7073
return StreamReadMessage.InitRequest(
7174
topics_read_settings=list(map(PublicTopicSelector._to_topic_read_settings, selectors)), # type: ignore

0 commit comments

Comments
 (0)