From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 24 Aug 2022 21:16:47 +0000 (-0700) Subject: Fix CodeQL warnings X-Git-Tag: v1.9.0-beta.rc1~26^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1375%2Fhead;p=thirdparty%2Fpaperless-ngx.git Fix CodeQL warnings --- diff --git a/src/documents/views.py b/src/documents/views.py index b9c8a12659..0e380c217f 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":