Skip to content

symfonic.core.contracts.errors

errors

Phase 3 error types. BuildWarning and BuildResult are frozen dataclasses.

BuildResult dataclass

BuildResult(
    content: str,
    status: Literal["success", "partial", "failed"],
    warnings: tuple[BuildWarning, ...] = (),
    degraded_sections: tuple[str, ...] = (),
)

Result of a prompt build operation.

BuildWarning dataclass

BuildWarning(
    section: str,
    type: Literal["degraded", "critical_error"],
    message: str,
)

Warning emitted during prompt build.

CapabilityError

CapabilityError(
    capability: str,
    cause: str,
    code: str,
    metadata: dict[str, Any] | None = None,
)

Bases: Exception

Error from an external capability (fetch, search, etc.).

Not a frozen dataclass — exceptions must support traceback assignment. Fields are set as regular attributes for compatibility.

Source code in src/symfonic/core/contracts/errors.py
def __init__(
    self,
    capability: str,
    cause: str,
    code: str,
    metadata: dict[str, Any] | None = None,
) -> None:
    self.capability = capability
    self.cause = cause
    self.code = code
    self.metadata = metadata or {}
    super().__init__(str(self))