diff --git a/End_to_end_Solutions/AOAISearchDemo/app/data/app.py b/End_to_end_Solutions/AOAISearchDemo/app/data/app.py index 6e00849..6a46321 100644 --- a/End_to_end_Solutions/AOAISearchDemo/app/data/app.py +++ b/End_to_end_Solutions/AOAISearchDemo/app/data/app.py @@ -200,7 +200,8 @@ def get_user_profile(user_id: str): else: return Response(response=json.dumps(user_profile.to_item()), status=200) except Exception as e: - return Response(response=str(e), status=500) + app.logger.error(f"Error in get_user_profile: {e}") + return Response(response="An internal error has occurred.", status=500) @app.route('/user-profiles', methods=['GET']) def get_all_user_profiles(): @@ -209,7 +210,8 @@ def get_all_user_profiles(): json_user_profiles = [user_profile.to_item() for user_profile in user_profiles] return Response(response=json.dumps(json_user_profiles), status=200) except Exception as e: - return Response(response=str(e), status=500) + app.logger.error(f"Error in get_all_user_profiles: {e}") + return Response(response="An internal error has occurred.", status=500) @app.route('/user-groups/', methods=['POST']) def create_user_group(group_id: str): @@ -233,7 +235,8 @@ def create_user_group(group_id: str): except CosmosConflictError as e: return Response(response=str(e), status=409) except Exception as e: - return Response(response=str(e), status=500) + app.logger.error(f"Error in create_user_group: {e}") + return Response(response="An internal error has occurred.", status=500) @app.route('/user-groups/', methods=['GET']) def get_user_group(group_id: str):