chore: standardize session not found error (#3031)

# What does this PR do?
1. Creates a new `SessionNotFoundError` class
2. Implements the new class where appropriate 

Relates to #2379

Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
This commit is contained in:
Nathan Weinberg 2025-08-04 16:12:02 -04:00 committed by GitHub
parent 05cfa213b6
commit 68b0071861
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 15 deletions

View file

@ -50,3 +50,11 @@ class ToolGroupNotFoundError(ValueError):
f"Tool group '{toolgroup_name}' not found. Use client.toolgroups.list() to list available tool groups."
)
super().__init__(message)
class SessionNotFoundError(ValueError):
"""raised when Llama Stack cannot find a referenced session or access is denied"""
def __init__(self, session_name: str) -> None:
message = f"Session '{session_name}' not found or access denied."
super().__init__(message)