Coverage for src/loman/exception.py: 100%

19 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-10-21 05:36 +0000

1"""Exception classes for the loman computation engine.""" 

2 

3 

4class ComputationError(Exception): 

5 """Base exception for computation-related errors.""" 

6 

7 pass 

8 

9 

10class MapError(ComputationError): 

11 """Exception raised during map operations with partial results.""" 

12 

13 def __init__(self, message, results): 

14 """Initialize MapError with message and partial results.""" 

15 super().__init__(message) 

16 self.results = results 

17 

18 

19class LoopDetectedError(ComputationError): 

20 """Exception raised when a dependency loop is detected.""" 

21 

22 pass 

23 

24 

25class NonExistentNodeError(ComputationError): 

26 """Exception raised when trying to access a non-existent node.""" 

27 

28 pass 

29 

30 

31class NodeAlreadyExistsError(ComputationError): 

32 """Exception raised when trying to create a node that already exists.""" 

33 

34 pass 

35 

36 

37class CannotInsertToPlaceholderNodeError(ComputationError): 

38 """Exception raised when trying to insert into a placeholder node.""" 

39 

40 pass 

41 

42 

43# Backward compatibility aliases 

44MapException = MapError 

45LoopDetectedException = LoopDetectedError 

46NonExistentNodeException = NonExistentNodeError 

47NodeAlreadyExistsException = NodeAlreadyExistsError 

48CannotInsertToPlaceholderNodeException = CannotInsertToPlaceholderNodeError