Skip to content

Commit 6e44ee2

Browse files
committed
fix: improve error handling for non-existent conversation records
1 parent dcab5d0 commit 6e44ee2

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

apps/chat/serializers/chat.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,8 @@ def get_chat_record(chat_info, chat_record_id):
384384
return chat_record_list[-1]
385385
chat_record = QuerySet(ChatRecord).filter(id=chat_record_id, chat_id=chat_info.chat_id).first()
386386
if chat_record is None:
387-
raise ChatException(500, _("Conversation record does not exist"))
388-
389-
return chat_record
387+
if not is_valid_uuid(chat_record_id):
388+
raise ChatException(500, _("Conversation record does not exist"))
390389
chat_record = QuerySet(ChatRecord).filter(id=chat_record_id).first()
391390
return chat_record
392391

0 commit comments

Comments
 (0)