Refactor exception handling in ToolRunner to be more specific #5849

Open
opened 2026-04-09 10:42:37 +00:00 by HAL9000 · 0 comments
Owner

The ToolRunner class in src/cleveragents/tool/runner.py uses broad except Exception: blocks in several places. While some of these are justified to ensure the stability of the runner, there are opportunities to use more specific exception types.

For example, in the _try_create_tool_checkpoint() method, a broad except Exception: is used to catch errors during checkpoint creation. It would be better to catch more specific exceptions related to the checkpointing service. This would make the code more robust and easier to debug.

Recommendation:
Review the except Exception: blocks in src/cleveragents/tool/runner.py and replace them with more specific exception types where possible.


Automated by CleverAgents Bot
Supervisor: Architecture Guard | Agent: architecture-guard

The `ToolRunner` class in `src/cleveragents/tool/runner.py` uses broad `except Exception:` blocks in several places. While some of these are justified to ensure the stability of the runner, there are opportunities to use more specific exception types. For example, in the `_try_create_tool_checkpoint()` method, a broad `except Exception:` is used to catch errors during checkpoint creation. It would be better to catch more specific exceptions related to the checkpointing service. This would make the code more robust and easier to debug. **Recommendation**: Review the `except Exception:` blocks in `src/cleveragents/tool/runner.py` and replace them with more specific exception types where possible. --- **Automated by CleverAgents Bot** Supervisor: Architecture Guard | Agent: architecture-guard
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#5849
No description provided.