Skip to content

Commit 34b68c5

Browse files
Refactor error handling in OrchestrationManager to improve clarity and remove unused imports
1 parent 5e1daae commit 34b68c5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/backend/v3/orchestration/orchestration_manager.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import List, Optional
77

88
from common.config.app_config import config
9-
from common.models.messages_kernel import TeamConfiguration, AgentMessage, AgentType
9+
from common.models.messages_kernel import TeamConfiguration
1010
from semantic_kernel.agents.orchestration.magentic import MagenticOrchestration
1111
from semantic_kernel.agents.runtime import InProcessRuntime
1212
from azure.core.exceptions import ResourceNotFoundError
@@ -22,7 +22,6 @@
2222
from v3.magentic_agents.magentic_agent_factory import MagenticAgentFactory
2323
from v3.models.messages import WebsocketMessageType
2424
from v3.orchestration.human_approval_manager import HumanApprovalMagenticManager
25-
from common.database.database_factory import DatabaseFactory
2625

2726

2827
class OrchestrationManager:
@@ -190,9 +189,7 @@ async def run_orchestration(self, user_id, input_task) -> None:
190189
if hasattr(e, "__dict__"):
191190
self.logger.info(f"Error attributes: {e.__dict__}")
192191
self.logger.info("=" * 50)
193-
194192
error_content = "The agent is currently unavailable. Please check if it was deleted or recreated.\n\nIf yes, please create a new plan from the home page."
195-
196193
self.logger.info(f"🔴 Sending error message to user {user_id}: {error_content}")
197194

198195
await connection_config.send_status_update_async(
@@ -207,7 +204,6 @@ async def run_orchestration(self, user_id, input_task) -> None:
207204
user_id,
208205
message_type=WebsocketMessageType.ERROR_MESSAGE,
209206
)
210-
211207
self.logger.info(f"✅ Error message sent via WebSocket to user {user_id}")
212208

213209
except Exception as e:
@@ -272,7 +268,7 @@ async def run_orchestration(self, user_id, input_task) -> None:
272268
self.logger.info("=" * 50)
273269

274270
error_content = "Something went wrong.\n\nPlease try creating a new plan from the home page or try again later."
275-
271+
276272
self.logger.info(f"🔴 Sending error message to user {user_id}: {error_content}")
277273

278274
await connection_config.send_status_update_async(
@@ -287,7 +283,7 @@ async def run_orchestration(self, user_id, input_task) -> None:
287283
user_id,
288284
message_type=WebsocketMessageType.ERROR_MESSAGE,
289285
)
290-
286+
291287
self.logger.info(f"✅ Error message sent via WebSocket to user {user_id}")
292288

293289
finally:

0 commit comments

Comments
 (0)