kerdosai / exceptions.py
Anonymous Hunter
feat: Add robust configuration management, Docker support, initial testing, and quickstart documentation.
f21249a
"""
Custom exceptions for KerdosAI.
"""
class KerdosError(Exception):
"""Base exception for all KerdosAI errors."""
def __init__(self, message: str, details: dict = None):
self.message = message
self.details = details or {}
super().__init__(self.message)
def __str__(self):
if self.details:
details_str = ", ".join(f"{k}={v}" for k, v in self.details.items())
return f"{self.message} ({details_str})"
return self.message
class ConfigurationError(KerdosError):
"""Raised when there's an error in configuration."""
pass
class ModelError(KerdosError):
"""Base exception for model-related errors."""
pass
class ModelLoadError(ModelError):
"""Raised when model loading fails."""
pass
class ModelSaveError(ModelError):
"""Raised when model saving fails."""
pass
class ModelInitializationError(ModelError):
"""Raised when model initialization fails."""
pass
class DataError(KerdosError):
"""Base exception for data-related errors."""
pass
class DataLoadError(DataError):
"""Raised when data loading fails."""
pass
class DataValidationError(DataError):
"""Raised when data validation fails."""
pass
class DataProcessingError(DataError):
"""Raised when data processing fails."""
pass
class TrainingError(KerdosError):
"""Base exception for training-related errors."""
pass
class TrainingConfigurationError(TrainingError):
"""Raised when training configuration is invalid."""
pass
class CheckpointError(TrainingError):
"""Raised when checkpoint operations fail."""
pass
class DeploymentError(KerdosError):
"""Base exception for deployment-related errors."""
pass
class DeploymentConfigurationError(DeploymentError):
"""Raised when deployment configuration is invalid."""
pass
class InferenceError(KerdosError):
"""Raised when inference fails."""
pass
class ResourceError(KerdosError):
"""Raised when there are resource-related issues (GPU, memory, etc.)."""
pass
class DependencyError(KerdosError):
"""Raised when required dependencies are missing or incompatible."""
pass