Skip to content

Commit

Permalink
Merge branch 'codeql' into alert-autofix-42
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitjain099 authored Oct 20, 2024
2 parents d3640fd + 2e19f99 commit 214ebd7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions End_to_end_Solutions/AOAISearchDemo/app/data/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ def get_user_profile(user_id: str):
else:
return Response(response=json.dumps(user_profile.to_item()), status=200)
except Exception as e:
logger.exception(f"get-user-profile: error: {e}")
return Response(response="An internal server error occurred.", status=500)
logging.error("An error occurred while fetching user profile: %s", e, exc_info=True)
return Response(response="An internal error has occurred.", status=500)

@app.route('/user-profiles', methods=['GET'])
def get_all_user_profiles():
Expand All @@ -215,8 +215,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:
logger.exception(f"get-all-user-profiles: error: {e}")
return Response(response="An internal server error occurred.", status=500)
logging.error("An error occurred while fetching all user profiles: %s", e, exc_info=True)
return Response(response="An internal error has occurred.", status=500)

@app.route('/user-groups/<group_id>', methods=['POST'])
def create_user_group(group_id: str):
Expand All @@ -240,8 +240,8 @@ def create_user_group(group_id: str):
except CosmosConflictError as e:
return Response(response=str(e), status=409)
except Exception as e:
logger.exception(f"create-user-group: error: {e}")
return Response(response="An internal server error occurred.", status=500)
logging.error("An error occurred while creating user group: %s", e, exc_info=True)
return Response(response="An internal error has occurred.", status=500)

@app.route('/user-groups/<group_id>', methods=['GET'])
def get_user_group(group_id: str):
Expand Down Expand Up @@ -284,7 +284,8 @@ def update_user_group(group_id: str):
user_group = entities_manager.add_users_to_user_group(group_id, new_users)
return Response(response=json.dumps(user_group.to_item()), status=200)
except (TypeError, NullValueError, MissingPropertyError, ValueError) as e:
return Response(response=str(e), status=400)
logging.error("An error occurred while updating user group: %s", e, exc_info=True)
return Response(response="An internal error has occurred.", status=400)
except SessionNotFoundError as e:
logging.error("Session not found: %s", e, exc_info=True)
return Response(response="Session not found.", status=404)
Expand Down

0 comments on commit 214ebd7

Please sign in to comment.