from __future__ import annotations
class AcbError(Exception):
def __init__(self, message: str = "", *, code: int = -1) -> None:
self.code = code
super().__init__(message)
class GraphNotFoundError(AcbError):
def __init__(self, path: str = "") -> None:
self.path = path
super().__init__(f"Graph not found: {path}", code=-3)
class UnitNotFoundError(AcbError):
def __init__(self, unit_id: int = 0) -> None:
self.unit_id = unit_id
super().__init__(f"Code unit not found: {unit_id}", code=-3)
class CompileError(AcbError):
def __init__(self, message: str = "Compilation failed") -> None:
super().__init__(message, code=-2)
class StorageError(AcbError):
def __init__(self, path: str = "", message: str = "") -> None:
self.path = path
msg = message or f"Storage error: {path}" if path else "Storage error"
super().__init__(msg, code=-1)
class LibraryNotFoundError(AcbError):
def __init__(self, searched: list[str] | None = None) -> None:
self.searched = searched or []
paths = ", ".join(self.searched) if self.searched else "(none)"
super().__init__(
f"Native library not found. Searched: {paths}",
code=-1,
)
class ValidationError(AcbError):
def __init__(self, message: str = "Validation failed") -> None:
super().__init__(message, code=-6)
class OverflowError(AcbError):
def __init__(self, message: str = "Buffer overflow") -> None:
super().__init__(message, code=-4)