chore: standardize unsupported database error

Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
This commit is contained in:
Nathan Weinberg 2025-07-30 16:44:01 -04:00 committed by Nathan Weinberg
parent faf891b40c
commit bec5ef537d
2 changed files with 22 additions and 11 deletions

View file

@ -9,6 +9,8 @@
# 2. All classes should have a custom error message with the goal of informing the Llama Stack user specifically
# 3. All classes should propogate the inherited __init__ function otherwise via 'super().__init__(message)'
from llama_stack.providers.utils.sqlstore.sqlstore import SqlStoreType
class ResourceNotFoundError(ValueError):
"""generic exception for a missing Llama Stack resource"""
@ -28,6 +30,16 @@ class UnsupportedModelError(ValueError):
super().__init__(message)
class UnsupportedSqlStoreError(ValueError):
"""raised when SQL store is not present in the list of supported SQL stores"""
def __init__(self, sqlstore_type: str):
message = (
f"'{sqlstore_type}' SQL store is not supported. Supported SQL stores are: {', '.join(list(SqlStoreType))}"
)
super().__init__(message)
class ModelNotFoundError(ResourceNotFoundError):
"""raised when Llama Stack cannot find a referenced model"""