FIX Internal server error when passes an invalid president ID #115#121
FIX Internal server error when passes an invalid president ID #115#121rusiru-erandaka wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a validation step to the active_portfolio_list method in organisation_service.py to ensure the president exists before retrieving active portfolios, along with corresponding unit tests. The feedback points out that get_entities raises a NotFoundError instead of returning an empty list or None when an entity is missing. Consequently, the check if not president_node_data: is redundant. The reviewer suggests catching the NotFoundError and re-raising it with a custom message, and updating the unit test mock to raise NotFoundError to accurately simulate the service's behavior.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Hi @ChanukaUOJ , is there any issue in this PR that i want to be update ?? |
Summary
Fixes the
Internal Server Errorreturned by theactive-portfolio-listendpoint when an invalid president ID is passed as a query parameter.Solution
Added a president existence validation at the beginning of the
tryblock in theactive_portfolio_listmethod, before fetching the active relationships.opengin_service.get_entities(Entity(id=president_id))to verify the president existsNotFoundExceptionwith a clear message instead of an unhandledInternalServerError