Skip to content

Commit 99689ad

Browse files
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>
1 parent 4fcc5a4 commit 99689ad

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

python/packages/ag-ui/agent_framework_ag_ui/_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ async def event_generator():
9191
)
9292
except Exception as e:
9393
logger.error(f"Error in agent endpoint: {e}", exc_info=True)
94-
return {"error": str(e)}
94+
return {"error": "An internal error has occurred."}

python/packages/ag-ui/tests/test_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ async def test_endpoint_error_handling():
154154
assert response.status_code == 200
155155
content = json.loads(response.content)
156156
assert "error" in content
157-
assert "Expecting value" in content["error"]
157+
assert content["error"] == "An internal error has occurred."
158158

159159

160160
async def test_endpoint_multiple_paths():

0 commit comments

Comments
 (0)