@@ -205,7 +205,8 @@ def get_user_profile(user_id: str):
205205 else :
206206 return Response (response = json .dumps (user_profile .to_item ()), status = 200 )
207207 except Exception as e :
208- return Response (response = str (e ), status = 500 )
208+ logging .error ("An error occurred while fetching user profile: %s" , e , exc_info = True )
209+ return Response (response = "An internal error has occurred." , status = 500 )
209210
210211@app .route ('/user-profiles' , methods = ['GET' ])
211212def get_all_user_profiles ():
@@ -214,7 +215,8 @@ def get_all_user_profiles():
214215 json_user_profiles = [user_profile .to_item () for user_profile in user_profiles ]
215216 return Response (response = json .dumps (json_user_profiles ), status = 200 )
216217 except Exception as e :
217- return Response (response = str (e ), status = 500 )
218+ logging .error ("An error occurred while fetching all user profiles: %s" , e , exc_info = True )
219+ return Response (response = "An internal error has occurred." , status = 500 )
218220
219221@app .route ('/user-groups/<group_id>' , methods = ['POST' ])
220222def create_user_group (group_id : str ):
@@ -238,7 +240,8 @@ def create_user_group(group_id: str):
238240 except CosmosConflictError as e :
239241 return Response (response = str (e ), status = 409 )
240242 except Exception as e :
241- return Response (response = str (e ), status = 500 )
243+ logging .error ("An error occurred while creating user group: %s" , e , exc_info = True )
244+ return Response (response = "An internal error has occurred." , status = 500 )
242245
243246@app .route ('/user-groups/<group_id>' , methods = ['GET' ])
244247def get_user_group (group_id : str ):
0 commit comments