zett_agent.sandbox.errors 源代码

"""Errors raised by the sandbox layer."""

from ..exceptions import AgentError


[文档] class SandboxError(AgentError): """Base error for sandbox failures."""
[文档] class SandboxPolicyError(SandboxError, ValueError): """A policy is malformed or names something the sandbox cannot enforce. It is also a ``ValueError``, so code that validates user input with the standard exception keeps working. """
[文档] class SandboxUnavailableError(SandboxError): """The requested sandbox cannot run on this machine. The message says why and, where a fix exists, what to install or change. The sandbox layer never answers this by running the command unsandboxed: the caller chooses :class:`~zett_agent.sandbox.passthrough.PassthroughSandbox` explicitly, or fixes the machine. """
[文档] class SandboxClosedError(SandboxError): """The session was closed (or never opened), so it cannot run anything."""
[文档] class SandboxCommandError(SandboxError): """A command run with ``check=True`` did not succeed. Attributes: result: The full :class:`~zett_agent.sandbox.base.SandboxResult`, so the output and the resource report are still available to the handler. """ def __init__(self, message: str, result: object) -> None: super().__init__(message) self.result = result