cadrumo.domain.portals.errors module

Error hierarchy for the portal catalogue.

Every error raised from cadrumo.domain.portals derives from PortalRegistryError, which in turn derives from the project root cadrumo.core.errors.hierarchy.CadrumoError. Two concrete subclasses cover the failure modes surfaced to external callers:

  • UnknownPortalError — raised by registry lookups on an unknown / unparseable portal name.

  • PortalIntegrityError — raised at import time during registry assembly when a structural invariant is violated.

class PortalRegistryPrecondition(*values)[source]

Bases: StrEnum

Closed failed-condition identities for portal registry refusals.

PORTAL_REGISTERED
MODELO_CODE_RECOGNISED
INTEGRITY_VALID
class PortalRegistryInvariant(*values)[source]

Bases: StrEnum

The internal portal-registry properties that must hold at assembly.

REPLACED_BY_TARGET_REGISTERED
PORTAL_ENTRY_UNIQUE
PORTAL_ENUM_COVERAGE_COMPLETE
ENTRY_PORTAL_MATCHES_MAPPING_KEY
PORTAL_ENUM_CONSUMER_RESOLVES
PORTAL_ID_CONSUMER_RESOLVES
REGISTRY_PORTAL_BINDINGS_AVAILABLE
class PortalFailureClassification(condition, facts, provenance, outcome)[source]

Bases: object

Domain facts that the application boundary must project as a terminal refusal.

Parameters:
condition: PortalRegistryPrecondition
facts: Mapping[str, str | int | bool]
provenance: ActionEvidenceProvenance
outcome: NoRecoveryOutcome
exception PortalRegistryError(message=None, *, context=None, translated_message=None, portal_failure=None, precondition_verdict=None)[source]

Bases: TerminalPreconditionErrorMixin[object], CadrumoError

Base error carrying a domain classification and optional boundary verdict.

Parameters:
Return type:

None

property portal_failure: PortalFailureClassification | None

Return the domain-owned failure classification for a boundary to project.

code
exception UnknownPortalError(portal)[source]

Bases: PortalRegistryError

Raised by cadrumo.domain.portals.registry.get_portal() on unknown names.

The operator-facing text is the class’s registered locale key and nothing else. The offending identifier travels as a locale-neutral machine fact in context, so it is never spelled into a sentence the class would then carry into tracebacks, structured logs and every direct rendering in all four locales.

The key is read from the central error-code registry rather than repeated here, so the class carries no second spelling that could drift from the registered one.

Variables:

portal – The offending portal name or value as supplied by the caller.

Parameters:

portal (str)

Return type:

None

code
exception PortalIntegrityError(message=None, *, context=None, translated_message=None, portal_failure=None, precondition_verdict=None)[source]

Bases: PortalRegistryError

Raised at import time when the registry fails a structural check.

Signals that a portal registry entry violates a structural invariant, such as a missing member, extra member, duplicate entry, or dangling replaced_by reference. It can also surface invalid registry-backed portal bindings during lookup.

Parameters:
Return type:

None

code
exception PortalValidationError(message=None, *, context=None, translated_message=None, portal_failure=None, precondition_verdict=None)[source]

Bases: PortalRegistryError

Raised when portal metadata violates state or shape invariants.

Pydantic validators translate this registered failure to ValueError at their narrow protocol boundary.

Parameters:
Return type:

None

code
unknown_modelo_error(modelo)[source]

Return the terminal refusal for an invalid portal-list modelo request.

Return type:

PortalValidationError

Parameters:

modelo (str)

portal_integrity_error(invariant, *, facts)[source]

Return a redacted structural-invariant refusal for portal assembly.

Return type:

PortalIntegrityError

Parameters: