From 214566ec8f3a9abeed5e4fe68db6eea5d6419c8d Mon Sep 17 00:00:00 2001 From: jain Date: Mon, 21 Aug 2023 19:09:44 +0530 Subject: [PATCH] Error response --- account/utils.py | 2 +- guardian/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/account/utils.py b/account/utils.py index cbdab1e..57fc273 100644 --- a/account/utils.py +++ b/account/utils.py @@ -204,7 +204,7 @@ def custom_error_response(detail, response_status): if not detail: """when details is empty""" detail = {} - return Response({"error": detail, "status": "failed", "code": response_status}) + return Response({"error": detail, "status": "failed", "code": response_status}, status=status.HTTP_400_BAD_REQUEST) def get_user_data(attrs): diff --git a/guardian/views.py b/guardian/views.py index 042150c..843ab45 100644 --- a/guardian/views.py +++ b/guardian/views.py @@ -337,7 +337,7 @@ class ApproveTaskAPIView(viewsets.ModelViewSet): serializer.save() return custom_response(SUCCESS_CODE['3026'], response_status=status.HTTP_200_OK) else: - return custom_response(ERROR_CODE['2038'], response_status=status.HTTP_400_BAD_REQUEST) + return custom_error_response(ERROR_CODE['2038'], response_status=status.HTTP_400_BAD_REQUEST) except Exception as e: return custom_error_response(str(e), response_status=status.HTTP_400_BAD_REQUEST)