From 16b468d9abc60d8b154a2a7e7f9e3dedab71cf4b Mon Sep 17 00:00:00 2001 From: agatha Date: Mon, 1 Apr 2024 00:04:04 -0400 Subject: [PATCH] return error when thread is not found --- backend/forum.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/forum.py b/backend/forum.py index 92dd41c..672b686 100644 --- a/backend/forum.py +++ b/backend/forum.py @@ -85,6 +85,9 @@ async def get_thread(thread_id: int): if post.thread_id == thread_id: result.append(post) + if len(result) == 0: + return {'error': 'could not find parent thread'} + return result