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 e42c841 commit 070d459
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion agents-api/agents_api/common/exceptions/sessions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
"""
Defines session-related exceptions for the agents API.
These exceptions are used throughout the agents API to handle errors related to session operations, such as when a requested session cannot be found.
"""
from uuid import UUID
from . import BaseCommonException


"""
Base exception class for session-related errors.
This class serves as a base for all session-related exceptions, allowing for a structured exception handling approach specific to session operations.
"""
class BaseSessionException(BaseCommonException):
pass


"""
Exception raised when a session cannot be found.
This exception is used to indicate that a specific session, identified by its session ID, does not exist or is not accessible for the given developer.
"""
class SessionNotFoundError(BaseSessionException):
def __init__(self, developer_id: UUID | str, session_id: UUID | str):
"""
Initializes a new instance of the SessionNotFoundError.
Args:
developer_id (UUID | str): The unique identifier of the developer attempting to access the session.
session_id (UUID | str): The unique identifier of the session that was not found.
"""
def __init__(self, developer_id: UUID | str, session_id: UUID | str):
super().__init__(
f"Session {str(session_id)} not found for developer {str(developer_id)}",
http_code=404,
Expand Down

0 comments on commit 070d459

Please sign in to comment.