Skip to content

Commit

Permalink
Fix code scanning alert no. 48: Information exposure through an excep…
Browse files Browse the repository at this point in the history
…tion

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
1 parent a357f73 commit cca2f62
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions End_to_end_Solutions/AOAISearchDemo/app/data/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ def get_user_group(group_id: str):
else:
return Response(response=json.dumps(user_group.to_item()), status=200)
except Exception as e:
return Response(response=str(e), status=500)
app.logger.error(f"Error in get_user_group: {e}")
return Response(response="An internal error has occurred.", status=500)

@app.route('/user-groups/user/<user_id>', methods=['GET'])
def get_user_member_groups(user_id: str):
Expand All @@ -255,7 +256,8 @@ def get_user_member_groups(user_id: str):
else:
return Response(response=json.dumps([user_group.to_item_no_users() for user_group in user_groups]), status=200)
except Exception as e:
return Response(response=str(e), status=500)
app.logger.error(f"Error in get_user_member_groups: {e}")
return Response(response="An internal error has occurred.", status=500)

@app.route('/user-groups/<group_id>', methods=['PUT'])
def update_user_group(group_id: str):
Expand All @@ -277,7 +279,8 @@ def update_user_group(group_id: str):
except SessionNotFoundError as e:
return Response(response=str(e), status=404)
except Exception as e:
return Response(response=str(e), status=500)
app.logger.error(f"Error in update_user_group: {e}")
return Response(response="An internal error has occurred.", status=500)

@app.route('/resources/<resource_id>', methods=['POST'])
def create_resource(resource_id: str):
Expand All @@ -296,7 +299,8 @@ def create_resource(resource_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_resource: {e}")
return Response(response="An internal error has occurred.", status=500)

@app.route('/resources/<resource_id>', methods=['GET'])
def get_resource(resource_id: str):
Expand Down

0 comments on commit cca2f62

Please sign in to comment.