fix: information leaking through print logs

This commit is contained in:
pablohashescobar 2024-03-11 21:06:01 +05:30
parent 31a2bbc4de
commit 7f67fe12af

View File

@ -112,17 +112,14 @@ class BaseAPIView(TimezoneMixin, APIView, BasePaginator):
)
if isinstance(e, ObjectDoesNotExist):
model_name = str(exc).split(" matching query does not exist.")[
0
]
return Response(
{"error": f"{model_name} does not exist."},
{"error": "The requested resource does not exist."},
status=status.HTTP_404_NOT_FOUND,
)
if isinstance(e, KeyError):
return Response(
{"error": f"key {e} does not exist"},
{"error": "The required key does not exist."},
status=status.HTTP_400_BAD_REQUEST,
)