From d8e47186ff14a0d8b5df0c72cb2e8200f87a2a6c Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Thu, 5 Dec 2024 15:21:55 +0500 Subject: [PATCH] feat: display exception msg in the API response if any --- courses/views/v1/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/courses/views/v1/__init__.py b/courses/views/v1/__init__.py index db41df1da..b1daca1bb 100644 --- a/courses/views/v1/__init__.py +++ b/courses/views/v1/__init__.py @@ -219,8 +219,8 @@ def get(self, request, *args, **kwargs): # noqa: ARG002 try: data = fetch_emeritus_courses() return Response(data, status=status.HTTP_200_OK) - except Exception: # noqa: BLE001 + except Exception as e: # noqa: BLE001 return Response( - {"error": "Some error occurred."}, + {"error": str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR, )