Coverage for src / ai_shell / exceptions.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-14 22:12 +0000

1"""Custom exceptions for ai-shell.""" 

2 

3 

4class AiShellError(Exception): 

5 """Base exception for ai-shell.""" 

6 

7 

8class DockerNotAvailableError(AiShellError): 

9 """Docker daemon is not running or not installed.""" 

10 

11 

12class ImagePullError(AiShellError): 

13 """Failed to pull Docker image.""" 

14 

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}") 

19 

20 

21class ContainerNotFoundError(AiShellError): 

22 """Container does not exist.""" 

23 

24 def __init__(self, name: str) -> None: 

25 self.name = name 

26 super().__init__(f"Container '{name}' not found") 

27 

28 

29class ConfigError(AiShellError): 

30 """Invalid configuration."""