cadrumo.domain.user_profile.errors module

Errors raised by the user-profile domain.

SCHEMA_LOAD_MESSAGE_KEY: Final[str]

Registered operator text for a user-profile schema that cannot be loaded. Stated once so the refusal and the gate that pins it read the same spelling, and held equal to the code registry’s own message_key by a test.

STORED_PROFILE_DRIFT_MESSAGE_KEY: Final[str]

Registered operator text for a persisted profile record that no longer validates. Shared with the transactions drift refusal, which reports the same condition over a different record.

exception UserProfileError(message=None, *, context=None, translated_message=None)[source]

Bases: CadrumoError

Base error for every domain.user_profile failure mode.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception UserProfileSchemaLoadError(*, context=None)[source]

Bases: UserProfileError

Raised when the committed user-profile schema cannot be loaded.

Constructed with facts only. The class supplies its registered key as the sole rendered text, and the keyword-only signature is what makes that structural rather than conventional: there is no positional slot an authored sentence could occupy, so str(exc) is the key in every locale and in every traceback and log line that renders the exception directly.

Variables:

context – Locale-neutral machine facts naming the failed precondition, the schema file and the stage of the load that refused.

Parameters:

context (Mapping[str, object] | None)

Return type:

None

code
exception UserProfileValidationError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Raised on invalid user profile values.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception UserProfileNotFoundError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Raised when a requested user profile section or field is missing.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileNotFoundError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Raised when a profile lookup targets an unknown profile_id.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileAlreadyExistsError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Raised when a register / duplicate command collides with an existing profile.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileSchemaValidationError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Raised when a lifecycle command’s facts violate the schema contract.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfilePreflightMissingError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Raised when modelo/revision preflight cannot find a required profile selector.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileSnapshotHashMismatchError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Raised when the recorded snapshot hash differs from the current projection.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileSnapshotNotFoundError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Raised when a snapshot id has no persisted record in the secure backend.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileSnapshotClassificationError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Raised when a stored snapshot’s classification violates its contract.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileSnapshotVersionError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Raised when a stored snapshot’s schema version is unsupported.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileBucketMismatchError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Raised when a payload’s profile identity is not the bound bucket’s own.

A profile bucket is an isolated store holding exactly one profile identity. This refuses the cross-profile read or write that the key-derivation habit alone did not prevent.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileExportError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Base error for profile-archive export failures (serialization, write).

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileImportError(message=None, *, context=None, translated_message=None)[source]

Bases: UserProfileError

Base error for profile-archive import failures (parse, signature, collision).

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileImportSignatureError(message=None, *, context=None, translated_message=None)[source]

Bases: ProfileImportError

Raised when a profile archive fails its signature/integrity check.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception ProfileImportCollisionError(message=None, *, context=None, translated_message=None)[source]

Bases: ProfileImportError

Raised when an imported profile_id collides with an existing profile.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception StoredProfileDriftError(*, profile_id, error)[source]

Bases: UserProfileError

Raised when a persisted profile record fails schema validation on load.

The record was valid when it was written; schema evolution or an out-of-band edit caused the on-disk representation to drift from the current UserProfileRecord schema. The original pydantic.ValidationError is preserved on original_exception so callers can inspect the typed field errors without losing the deserialization detail.

The CLI boundary catches this typed error and routes it to CliStoredDataValidationBoundaryError (distinct from the input-time CliValidationBoundaryError) so operators see a repair-oriented message rather than a generic refusal.

The refusal carries facts, not a way out. Which command repairs a drifted record is a decision about the operator surface, and this layer cannot see that surface: it names the contract that diverged and leaves the outcome to the CLI boundary, which classifies the wrapped refusal as a stored-data precondition and emits the typed no-recovery outcome for it. A command string carried here would be a second action authority competing with that one, unread by every consumer and wrong the moment the verb is renamed.

The facts name WHICH contract diverged and HOW MANY of its constraints failed, never the values that failed them. A violation’s location path reproduces mapping KEYS as well as field names, so a record keyed by a tax identifier would put that identifier in the fact; the redaction-aware projection that can tell those apart belongs to the boundary that owns the record type, and re-deriving it here would be a second, unredacted copy. original_exception carries the full typed detail to whoever is entitled to project it.

Variables:
  • profile_id – Generated profile identity (a UUIDv4, never a tax identifier) whose record drifted.

  • original_exception – The underlying pydantic.ValidationError.

Parameters:
  • profile_id (str)

  • error (ValidationError)

Return type:

None

code