Skip to content

Commit

Permalink
Updated HTTP status code for non-existent category
Browse files Browse the repository at this point in the history
  • Loading branch information
happychuks committed Nov 29, 2024
1 parent c066ef2 commit 36284ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/apps/research/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import uuid
import logging
from django.db import transaction
from rest_framework import serializers


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

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

0 comments on commit 36284ba

Please sign in to comment.