mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 04:04:14 +00:00
chore: standardize unsupported database error
Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
This commit is contained in:
parent
faf891b40c
commit
bec5ef537d
2 changed files with 22 additions and 11 deletions
|
@ -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"""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue