File size: 616 Bytes
4fac556
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Custom exceptions."""
from fastapi import HTTPException

class ModelNotFoundError(HTTPException):
    """Model not found exception."""
    def __init__(self, model_id: str):
        super().__init__(status_code=404, detail=f"Model not found: {model_id}")

class DataNotLoadedError(HTTPException):
    """Data not loaded exception."""
    def __init__(self):
        super().__init__(status_code=503, detail="Data not loaded")

class EmbeddingsNotReadyError(HTTPException):
    """Embeddings not ready exception."""
    def __init__(self):
        super().__init__(status_code=503, detail="Embeddings not ready")