errors.py
python
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83
chore(governance): sync handover+roadmap to 84db8c8 (drift:…
Human
16 hours ago
| 1 | """Typed errors for fail-closed adapter and config behavior.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from dataclasses import dataclass |
| 6 | |
| 7 | |
| 8 | @dataclass(frozen=True) |
| 9 | class ReadError: |
| 10 | """Returned when a VCS read command fails; caller must halt.""" |
| 11 | |
| 12 | command: str |
| 13 | message: str = "" |
| 14 | exit_code: int | None = None |
| 15 | |
| 16 | def __str__(self) -> str: |
| 17 | parts = [f"ReadError({self.command!r})"] |
| 18 | if self.message: |
| 19 | parts.append(self.message) |
| 20 | if self.exit_code is not None: |
| 21 | parts.append(f"exit={self.exit_code}") |
| 22 | return ": ".join(parts) |
| 23 | |
| 24 | |
| 25 | @dataclass(frozen=True) |
| 26 | class ConfigError(Exception): |
| 27 | """Raised when config is missing, unparseable, or unsupported.""" |
| 28 | |
| 29 | message: str |
| 30 | path: str | None = None |
| 31 | exit_code: int | None = None |
| 32 | |
| 33 | def __str__(self) -> str: |
| 34 | if self.path: |
| 35 | return f"{self.path}: {self.message}" |
| 36 | return self.message |
| 37 | |
| 38 | |
| 39 | @dataclass(frozen=True) |
| 40 | class WriteError: |
| 41 | """Returned when a VCS write is refused or fails.""" |
| 42 | |
| 43 | command: str |
| 44 | message: str |
| 45 | exit_code: int | None = None |
| 46 | |
| 47 | def __str__(self) -> str: |
| 48 | return f"WriteError({self.command!r}): {self.message}" |
File History
1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199
fix(ISR): default require_independent_second_reviewer to require
Human
minor
⚠
15 hours ago