"""Transport error hierarchy.""" from __future__ import annotations class TransportError(RuntimeError): """Base class for transport-layer (WinRM/SSH) failures.""" class TransportConnectError(TransportError): """Raised when the underlying connection cannot be established.""" class TransportCommandError(TransportError): """Raised when a remote command exits non-zero.""" def __init__(self, returncode: int, stdout: str, stderr: str) -> None: super().__init__( f"Remote command failed (exit={returncode}): {(stderr or stdout).strip()[:500]}" ) self.returncode = returncode self.stdout = stdout self.stderr = stderr