Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion kafka/consumer/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,12 @@ def offsets_for_times(self, timestamps, timeout_ms=None):
"""
timeout_ms = self.config['request_timeout_ms'] if timeout_ms is None else timeout_ms
for tp, ts in timestamps.items():
timestamps[tp] = int(ts)
try:
timestamps[tp] = int(ts)
except (ValueError, TypeError, OverflowError):
raise ValueError(
"The target timestamp for partition {} is {}. Timestamps "
"must be a valid integer (milliseconds since epoch).".format(tp, ts))
if ts < 0:
raise ValueError(
"The target time for partition {} is {}. The target time "
Expand Down