Coverage for src/ai_shell/exceptions.py: 100%
16 statements
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-05 22:06 +0000
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-05 22:06 +0000
1"""Custom exceptions for ai-shell."""
4class AiShellError(Exception):
5 """Base exception for ai-shell."""
8class DockerNotAvailableError(AiShellError):
9 """Docker daemon is not running or not installed."""
12class ImagePullError(AiShellError):
13 """Failed to pull Docker image."""
15 def __init__(self, image: str, reason: str) -> None:
16 self.image = image
17 self.reason = reason
18 super().__init__(f"Failed to pull {image}: {reason}")
21class ContainerNotFoundError(AiShellError):
22 """Container does not exist."""
24 def __init__(self, name: str) -> None:
25 self.name = name
26 super().__init__(f"Container '{name}' not found")
29class ConfigError(AiShellError):
30 """Invalid configuration."""
33class GpuRequiredError(AiShellError):
34 """A container that requires an NVIDIA GPU was requested without one."""
36 def __init__(self, service: str) -> None:
37 self.service = service
38 super().__init__(
39 f"{service} requires an NVIDIA GPU (no CPU-only image is available). "
40 f"Install NVIDIA drivers + the NVIDIA Container Toolkit and retry."
41 )