Coverage for src / loman / exception.py: 100%
27 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-22 21:30 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-22 21:30 +0000
1"""Exception classes for the loman computation engine."""
4class ComputationError(Exception):
5 """Base exception for computation-related errors."""
7 pass
10class MapError(ComputationError):
11 """Exception raised during map operations with partial results."""
13 def __init__(self, message: str, results: list[object]) -> None:
14 """Initialize MapError with message and partial results."""
15 super().__init__(message)
16 self.results = results
19class LoopDetectedError(ComputationError):
20 """Exception raised when a dependency loop is detected."""
22 pass
25class NonExistentNodeError(ComputationError):
26 """Exception raised when trying to access a non-existent node."""
28 pass
31class NodeAlreadyExistsError(ComputationError):
32 """Exception raised when trying to create a node that already exists."""
34 pass
37class CannotInsertToPlaceholderNodeError(ComputationError):
38 """Exception raised when trying to insert into a placeholder node."""
40 pass
43class InvalidBlockTypeError(TypeError, ComputationError):
44 """Exception raised when a block is not callable or a Computation."""
46 pass
49class FittingError(ComputationError):
50 """Exception raised when curve fitting exceeds error tolerance."""
52 pass
55class ValidationError(ComputationError):
56 """Exception raised during computation validation."""
58 pass
61class SerializationError(ComputationError):
62 """Exception raised during serialization/deserialization."""
64 pass
67# Backward compatibility aliases
68MapException = MapError
69LoopDetectedException = LoopDetectedError
70NonExistentNodeException = NonExistentNodeError
71NodeAlreadyExistsException = NodeAlreadyExistsError
72CannotInsertToPlaceholderNodeException = CannotInsertToPlaceholderNodeError