Skip to content

Commit

Permalink
feat: Updated agents-api/agents_api/common/excepti
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Apr 13, 2024
1 parent 3c332ff commit 8988853
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions agents-api/agents_api/common/exceptions/agents.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
"""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,
)


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
)

0 comments on commit 8988853

Please sign in to comment.