Skip to content

Commit d08174c

Browse files
Copilotfriggeri
andcommitted
Use RuntimeError for consistent exception handling in delete_session
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
1 parent 26c7e18 commit d08174c

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

python/copilot/client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,8 +670,7 @@ async def delete_session(self, session_id: str) -> None:
670670
session_id: The ID of the session to delete.
671671
672672
Raises:
673-
RuntimeError: If the client is not connected.
674-
Exception: If the session does not exist or deletion fails.
673+
RuntimeError: If the client is not connected or deletion fails.
675674
676675
Example:
677676
>>> await client.delete_session("session-123")
@@ -684,7 +683,7 @@ async def delete_session(self, session_id: str) -> None:
684683
success = response.get("success", False)
685684
if not success:
686685
error = response.get("error", "Unknown error")
687-
raise Exception(f"Failed to delete session {session_id}: {error}")
686+
raise RuntimeError(f"Failed to delete session {session_id}: {error}")
688687

689688
# Remove from local sessions map if present
690689
with self._sessions_lock:

0 commit comments

Comments
 (0)