File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 22from rest_framework import viewsets , status
33from rest_framework .decorators import api_view
44from rest_framework .response import Response
5+ import logging
56from database import get_connection , close_connection
67from .serializers import UserSerializer , SignupSerializer , SigninSerializer
78
@@ -112,8 +113,9 @@ async def signup(request):
112113 "message" : "User registered successfully"
113114 }, status = status .HTTP_201_CREATED )
114115 except Exception as e :
116+ logging .exception ("Exception during signup" )
115117 return Response (
116- {"error" : str ( e ) },
118+ {"error" : "An internal error occurred. Please try again later." },
117119 status = status .HTTP_400_BAD_REQUEST
118120 )
119121 finally :
@@ -134,9 +136,10 @@ async def signin(request):
134136 "token" : token ,
135137 "message" : "Signed in successfully"
136138 })
139+ logging .exception ("Exception during signin" )
137140 except Exception as e :
138141 return Response (
139- {"error" : str ( e ) },
142+ {"error" : "Invalid credentials or unexpected error." },
140143 status = status .HTTP_401_UNAUTHORIZED
141144 )
142145 finally :
You can’t perform that action at this time.
0 commit comments