Skip to content

Commit

Permalink
Merge pull request #15 from arpitjain099/alert-autofix-44
Browse files Browse the repository at this point in the history
Fix code scanning alert no. 44: Information exposure through an exception
  • Loading branch information
arpitjain099 authored Oct 20, 2024
2 parents cca2f62 + 72888c1 commit f700359
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions End_to_end_Solutions/AOAISearchDemo/app/data/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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/<group_id>', methods=['POST'])
def create_user_group(group_id: str):
Expand All @@ -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/<group_id>', methods=['GET'])
def get_user_group(group_id: str):
Expand Down

0 comments on commit f700359

Please sign in to comment.