From bc99cf83dd0f3d1773bb0dc61f2c9793806cc04a Mon Sep 17 00:00:00 2001 From: Alessio <148966056+alessio-locatelli@users.noreply.github.com> Date: Sat, 21 Jun 2025 15:31:21 +0300 Subject: [PATCH] feat: add a bare `except` to catch all errors --- pr_agent/agent/pr_agent.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pr_agent/agent/pr_agent.py b/pr_agent/agent/pr_agent.py index 0a42a50d..1e995ffb 100644 --- a/pr_agent/agent/pr_agent.py +++ b/pr_agent/agent/pr_agent.py @@ -51,7 +51,7 @@ class PRAgent: def __init__(self, ai_handler: partial[BaseAiHandler,] = LiteLLMAIHandler): self.ai_handler = ai_handler # will be initialized in run_action - async def handle_request(self, pr_url, request, notify=None) -> bool: + async def _handle_request(self, pr_url, request, notify=None) -> bool: # First, apply repo specific settings if exists apply_repo_settings(pr_url) @@ -117,3 +117,10 @@ class PRAgent: else: return False return True + + async def handle_request(self, pr_url, request, notify=None) -> bool: + try: + return await self._handle_request(pr_url, request, notify) + except: + get_logger().exception("Failed to process the command.") + return False