popoto.exceptions¶
popoto.exceptions
¶
Custom exceptions for the Popoto Redis ORM library.
ModelException
¶
QueryException
¶
PublisherException
¶
SubscriberException
¶
KeyMutationError
¶
Bases: ModelException
Raised when a KeyField value is changed after initial save.
KeyField values form the Redis storage key (identity) of a model instance. Changing them silently would delete the old key and create a new one, potentially orphaning references. This exception prevents accidental identity changes.
To intentionally migrate a key, use save(migrate_key=True).
Example::
instance = MyModel.query.get(name="old_name")
instance.name = "new_name"
instance.save() # Raises KeyMutationError
# Intentional migration:
instance.save(migrate_key=True) # Succeeds
Source code in src/popoto/exceptions.py
SkipSaveException
¶
Bases: ModelException
Raised by WriteFilterMixin to silently abort a save operation.
When a model's compute_filter_score() returns a score below the minimum threshold, this exception is raised during pre_save to short-circuit persistence. The save() method catches it and returns without error.