Skip to content

Commit 24024f7

Browse files
chore: Improves session update time validation message (#446)
Enhances the error message when a session's last update time is later than the storage update time. This provides better readability by formatting the timestamps in the error message. Co-authored-by: Hangfei Lin <[email protected]>
1 parent c74879d commit 24024f7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/google/adk/sessions/database_session_service.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,11 @@ def append_event(self, session: Session, event: Event) -> Event:
484484

485485
if storage_session.update_time.timestamp() > session.last_update_time:
486486
raise ValueError(
487-
f"Session last_update_time {session.last_update_time} is later than"
488-
f" the upate_time in storage {storage_session.update_time}"
489-
)
487+
f"Session last_update_time "
488+
f"{datetime.fromtimestamp(session.last_update_time):%Y-%m-%d %H:%M:%S} "
489+
f"is later than the update_time in storage "
490+
f"{storage_session.update_time:%Y-%m-%d %H:%M:%S}"
491+
)
490492

491493
# Fetch states from storage
492494
storage_app_state = sessionFactory.get(

0 commit comments

Comments
 (0)