Skip to content

Commit 36284ba

Browse files
committed
Updated HTTP status code for non-existent category
1 parent c066ef2 commit 36284ba

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/apps/research/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import uuid
77
import logging
88
from django.db import transaction
9+
from rest_framework import serializers
10+
911

1012
from .models import Article, ArticleSlugHistory
1113
from .permissions import ArticleUserWritePermission
@@ -108,7 +110,7 @@ def retrieve_by_category(self, request, category=None):
108110
return Response({'success': True, 'data': serializer.data})
109111
except Exception as e:
110112
logger.error(f"Error retrieving articles by category: {e}")
111-
return Response({'error': 'Category does not exist'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
113+
return Response({'error': 'Category does not exist'}, status=status.HTTP_404_NOT_FOUND)
112114

113115
def is_valid_uuid(self, value):
114116
"""Check if the value is a valid UUID."""

0 commit comments

Comments
 (0)