Skip to content

Commit a560c31

Browse files
committed
update comments and logs
1 parent 32a9c94 commit a560c31

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

api/index.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,22 @@ def get_neighbors():
102102
logging.error("Repository name is missing in the request.")
103103
return jsonify({"status": "Repository name is required."}), 400
104104

105-
# Validate 'node_id' parameter
105+
# Validate 'node_ids' parameter
106106
if not node_ids:
107-
logging.error("Node ID is missing in the request.")
108-
return jsonify({"status": "Node ID is required."}), 400
107+
logging.error("Node IDs is missing in the request.")
108+
return jsonify({"status": "Node IDs is required."}), 400
109109

110110
# Validate repo exists
111111
if not graph_exists(repo):
112112
logging.error(f"Missing project {repo}")
113113
return jsonify({"status": f"Missing project {repo}"}), 400
114114

115-
# Try converting node_id to an integer
115+
# Try converting node_ids to an integer
116116
try:
117117
node_ids = [int(node_id) for node_id in node_ids]
118118
except ValueError:
119-
logging.error(f"Invalid node ID: {node_ids}. It must be an integer.")
120-
return jsonify({"status": "Invalid node ID. It must be an integer."}), 400
119+
logging.error(f"Invalid node IDs: {node_ids}. It must be an integer.")
120+
return jsonify({"status": "Invalid node IDs. It must be an integer."}), 400
121121

122122
# Initialize the graph with the provided repository
123123
g = Graph(repo)
@@ -126,7 +126,7 @@ def get_neighbors():
126126
neighbors = g.get_neighbors(node_ids)
127127

128128
# Log and return the neighbors
129-
logging.info(f"Successfully retrieved neighbors for node ID {node_ids} in repo '{repo}'.")
129+
logging.info(f"Successfully retrieved neighbors for node IDs {node_ids} in repo '{repo}'.")
130130

131131
response = {
132132
'status': 'success',

0 commit comments

Comments
 (0)