Coverage for src / harnessutils / exceptions.py: 93%
15 statements
« prev ^ index » next coverage.py v7.13.2, created at 2026-02-18 08:30 -0600
« prev ^ index » next coverage.py v7.13.2, created at 2026-02-18 08:30 -0600
1"""Custom exceptions for harness-utils with remediation guidance."""
4class HarnessError(Exception):
5 """Base exception for harness-utils errors."""
7 def __init__(self, message: str, remediation: str | None = None):
8 """Initialize with error message and optional remediation steps.
10 Args:
11 message: Error description
12 remediation: Steps to fix the error
13 """
14 self.message = message
15 self.remediation = remediation
16 super().__init__(self._format_error())
18 def _format_error(self) -> str:
19 """Format error with remediation if available."""
20 if self.remediation:
21 return f"{self.message}\n\nHow to fix:\n{self.remediation}"
22 return self.message
25class ConfigurationError(HarnessError):
26 """Invalid configuration detected."""
29class PruningError(HarnessError):
30 """Error during pruning operation."""
33class SummarizationError(HarnessError):
34 """Error during summarization operation."""
37class TruncationError(HarnessError):
38 """Error during truncation operation."""
41class SnapshotError(HarnessError):
42 """Error with snapshot operations."""
45class StorageError(HarnessError):
46 """Error with storage backend."""