Skip to content

Commit

Permalink
fix: Resolved Information exposure through an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
happychuks committed Nov 29, 2024
1 parent 8fda06e commit ae94f08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/apps/research/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def create(self, request, *args, **kwargs):
except Exception as e:
logger.error(f"Unexpected error during article creation: {e}")
if isinstance(e, serializers.ValidationError):
return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST)
return Response({'error': 'Invalid data provided'}, status=status.HTTP_400_BAD_REQUEST)
return Response({'error': 'Failed to create a new Article'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)

def update(self, request, *args, **kwargs):
Expand All @@ -58,7 +58,7 @@ def update(self, request, *args, **kwargs):
except Exception as e:
logger.error(f"Unexpected error during article update: {e}")
if isinstance(e, serializers.ValidationError):
return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST)
return Response({'error': 'Invalid data provided'}, status=status.HTTP_400_BAD_REQUEST)
return Response({'error': 'Error updating article'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)

# Custom action to retrieve articles by slug or UUID
Expand Down

0 comments on commit ae94f08

Please sign in to comment.