]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix CodeQL warnings 1375/head
authorMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Wed, 24 Aug 2022 21:16:47 +0000 (14:16 -0700)
committerMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Wed, 24 Aug 2022 21:24:10 +0000 (14:24 -0700)
src/documents/views.py

index b9c8a126593bd735a7ec1ecb2444bed7edb8d5f4..0e380c217f53ec18e9d2b92c6be0d8def920bf39 100644 (file)
@@ -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":