Python: clean up exception (#2319)

* Potential fix for code scanning alert no. 18: Information exposure through an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Fix test

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
Evan Mattson
2025-11-20 09:54:07 +09:00
committed by GitHub
Unverified
parent 4fcc5a4b7d
commit 99689add09
2 changed files with 2 additions and 2 deletions
@@ -91,4 +91,4 @@ def add_agent_framework_fastapi_endpoint(
)
except Exception as e:
logger.error(f"Error in agent endpoint: {e}", exc_info=True)
return {"error": str(e)}
return {"error": "An internal error has occurred."}
+1 -1
View File
@@ -154,7 +154,7 @@ async def test_endpoint_error_handling():
assert response.status_code == 200
content = json.loads(response.content)
assert "error" in content
assert "Expecting value" in content["error"]
assert content["error"] == "An internal error has occurred."
async def test_endpoint_multiple_paths():