From 8988853d63cedbbf4ffd97716b86259a29141aeb Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Sat, 13 Apr 2024 11:43:13 +0000 Subject: [PATCH] feat: Updated agents-api/agents_api/common/excepti --- agents-api/agents_api/common/exceptions/agents.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/agents-api/agents_api/common/exceptions/agents.py b/agents-api/agents_api/common/exceptions/agents.py index 5068663e..3c20e0a6 100644 --- a/agents-api/agents_api/common/exceptions/agents.py +++ b/agents-api/agents_api/common/exceptions/agents.py @@ -1,13 +1,18 @@ +"""Defines custom exceptions for agent-related operations in the agents API.""" + from uuid import UUID from . import BaseCommonException class BaseAgentException(BaseCommonException): + """Base exception class for all agent-related exceptions.""" pass class AgentNotFoundError(BaseAgentException): + """Exception raised when a requested agent cannot be found.""" def __init__(self, developer_id: UUID | str, agent_id: UUID | str): + # Initialize the exception with a message indicating the missing agent and developer ID. super().__init__( f"Agent {str(agent_id)} not found for developer {str(developer_id)}", http_code=404, @@ -15,14 +20,18 @@ def __init__(self, developer_id: UUID | str, agent_id: UUID | str): class AgentToolNotFoundError(BaseAgentException): + """Exception raised when a requested tool associated with an agent cannot be found.""" def __init__(self, agent_id: UUID | str, tool_id: UUID | str): + # Initialize the exception with a message indicating the missing tool and agent ID. super().__init__( f"Tool {str(tool_id)} not found for agent {str(agent_id)}", http_code=404 ) class AgentDocNotFoundError(BaseAgentException): + """Exception raised when a requested document associated with an agent cannot be found.""" def __init__(self, agent_id: UUID | str, doc_id: UUID | str): + # Initialize the exception with a message indicating the missing document and agent ID. super().__init__( f"Doc {str(doc_id)} not found for agent {str(agent_id)}", http_code=404 )