From cce1595c3d979c0e6877bea765106cc515db0e1b Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 24 Aug 2022 14:16:47 -0700 Subject: [PATCH] Fix CodeQL warnings --- src/documents/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/documents/views.py b/src/documents/views.py index b9c8a1265..0e380c217 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -409,7 +409,10 @@ class DocumentViewSet( try: return Response(self.getComments(doc)) except Exception as e: - return Response({"error": str(e)}) + logger.warning(f"An error occurred retrieving comments: {str(e)}") + return Response( + {"error": "Error retreiving comments, check logs for more detail."}, + ) elif request.method == "POST": try: c = Comment.objects.create( @@ -421,9 +424,10 @@ class DocumentViewSet( return Response(self.getComments(doc)) except Exception as e: + logger.warning(f"An error occurred saving comment: {str(e)}") return Response( { - "error": str(e), + "error": "Error saving comment, check logs for more detail.", }, ) elif request.method == "DELETE":