File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -270,8 +270,15 @@ def api_query(http_request: Request, request: QueryRequest):
270270 return JSONResponse (result )
271271 except ValueError as e :
272272 # ValueError for not found or not indexed
273+ # Log the full error but return generic message
273274 logger .warning (f"Query validation failed: { e } " )
274- return JSONResponse ({"error" : str (e )}, status_code = 400 )
275+ # Return safe, generic error messages
276+ if "not found" in str (e ).lower ():
277+ return JSONResponse ({"error" : "Project not found" }, status_code = 404 )
278+ elif "not indexed" in str (e ).lower ():
279+ return JSONResponse ({"error" : "Project not indexed yet" }, status_code = 400 )
280+ else :
281+ return JSONResponse ({"error" : "Invalid request" }, status_code = 400 )
275282 except Exception as e :
276283 logger .exception (f"Error querying project: { e } " )
277284 return JSONResponse ({"error" : "Query failed" }, status_code = 500 )
You can’t perform that action at this time.
0 commit comments