Exceptions¶
Table of Contents
Adapter exceptions¶
This module contains exceptions for
AdapterBase class.
-
exception
save_to_db.exceptions.adapter_except.AdapterException[source]¶ Bases:
ExceptionGeneral exception for
AdapterBaseclass.
-
exception
save_to_db.exceptions.adapter_except.CannotMergeModels[source]¶ Bases:
save_to_db.exceptions.adapter_except.AdapterExceptionRaised when merging two or more ORM models into one is impossible.
-
exception
save_to_db.exceptions.adapter_except.MergeModelsNotAllowed[source]¶ Bases:
save_to_db.exceptions.adapter_except.AdapterExceptionRaised when merging ORM models is forbidden.
Item class collection exceptions¶
This module contains exceptions for
ItemCollection class.
-
exception
save_to_db.exceptions.item_collection.CollectionDoesNotExist[source]¶ Bases:
save_to_db.exceptions.item_collection.ItemCollectionExceptionRaised when trying to get collection that does not exist using collection_id.
-
exception
save_to_db.exceptions.item_collection.CollectionIdAlreadyInUse[source]¶ Bases:
save_to_db.exceptions.item_collection.ItemCollectionExceptionRaised when trying to create new item class collection with collection_id value already taken.
-
exception
save_to_db.exceptions.item_collection.ItemCollectionException[source]¶ Bases:
ExceptionGeneral exception for
ItemCollectionclass.
Item configuration exceptions¶
This module contains exceptions for
Item class configuration. These
exceptions are only raised when an item configuration is correct in its
structure but cannot be used, for example, when a nonexistent relation is used.
If, for example, a boolean value was used instead of a list, general exception
will be raise when trying to deal with a boolean as with a list.
-
exception
save_to_db.exceptions.item_config.DeleterSelectorsOrKeepersEmpty[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaised when trying to use ModelDelete with either selector_fields or keeper_fields empty.
-
exception
save_to_db.exceptions.item_config.DeleterXToManyRelationUsed[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaised when trying to use x-to-many relationship as selector or keeper field.
-
exception
save_to_db.exceptions.item_config.FieldsFromRelationNotAllowed[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaised when configuration variable contains fields referencing fields of a relations.
-
exception
save_to_db.exceptions.item_config.InvalidFieldName[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaised when configuration uses model field name that has double underscores in it.
-
exception
save_to_db.exceptions.item_config.ItemAdapterNotFound[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaised when an adapter for a particular item class was not found during class setup.
-
exception
save_to_db.exceptions.item_config.ItemConfigError[source]¶ Bases:
ExceptionGeneral exception for configuration of
Itemclass.
-
exception
save_to_db.exceptions.item_config.MultipleRelatedItemsFound[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaised when:
- A related item was specified using a string path with an item class name only and there are no such class in the referencing item module but more then one in other modules.
- During auto configuration of
Itemrelations, when more then one item was found for a specific model class.
-
exception
save_to_db.exceptions.item_config.NonExistentFieldUsed[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaised when getters, creators, or nullables or any other configuration value contains field name that model_cls does not have.
-
exception
save_to_db.exceptions.item_config.NonExistentRelationDefined[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaised when relation is set for a field that does not exist or is not a foreign key field in corresponding model.
-
exception
save_to_db.exceptions.item_config.NorewriteKeyUsedTwice[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaised when same no-rewrite key used twice (trough tuples).
-
exception
save_to_db.exceptions.item_config.NorewriteRelationException[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaised when no-rewrite for a relationship set on both sides with different values.
-
exception
save_to_db.exceptions.item_config.RelatedItemNotFound[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaised when:
- A related item was specified using a string path but no item class was found using the path.
- During auto configuration of
Itemclass relations, when no item was found for a specific model class.
-
exception
save_to_db.exceptions.item_config.UnrefNonXToManyFieldUsed[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigErrorRaise when trying to use not x-to-many field as a key of unref_x_to_many dictionary of item configuration.
Item field usage exceptions¶
This module contains exceptions for
ItemBase related to fields usage.
-
exception
save_to_db.exceptions.item_field.BulkItemOneToXDefaultError[source]¶ Bases:
save_to_db.exceptions.item_field.ItemFieldErrorRaised when trying to assing an one-to-x default relationship value to a bulk item.
Explanation:
When trying to use as default item A with an x-to-one relationship with items B that we keep in bulk, that means that all items B going to referece item A, but item A can reverese refrence only 1 item B, this results in an exception.
-
exception
save_to_db.exceptions.item_field.ItemFieldError[source]¶ Bases:
ValueErrorGeneral exception for
ItemBasefield usage.
-
exception
save_to_db.exceptions.item_field.WrongAlias[source]¶ Bases:
save_to_db.exceptions.item_field.ItemFieldError,KeyErrorRaise when wrong alias is used.
Item persistence exceptions¶
This module contains exceptions for
ItemBase class related to persistence.
-
exception
save_to_db.exceptions.item_persist.CannotClearRequiredFieldInRelation[source]¶ Bases:
save_to_db.exceptions.item_persist.ItemPersistErrorRaise when trying to clear one-to-many field using “replace_x_to_many” setting of item, but field is required on the other side.
-
exception
save_to_db.exceptions.item_persist.CannotMergeModelsForItem[source]¶ Bases:
save_to_db.exceptions.item_persist.ItemPersistErrorRaised when merging two or more ORM models into one is impossible.
-
exception
save_to_db.exceptions.item_persist.ItemPersistError[source]¶ Bases:
ExceptionGeneral exception for
ItemBasepersistence.
-
exception
save_to_db.exceptions.item_persist.MultipleModelsMatch[source]¶ Bases:
save_to_db.exceptions.item_persist.ItemPersistErrorRaised when multiple models match the same item:
- When allow_multi_update set to False for the item.
- When trying to set multiple items to x-to-one relationship.
-
exception
save_to_db.exceptions.item_persist.PersistMultipleItemsMatch[source]¶ Bases:
save_to_db.exceptions.item_persist.ItemPersistErrorRaised when multiple items match the same model during persisting.
Item process exceptions¶
This module contains exceptions that are raised when there is an error during processing of an item.
-
exception
save_to_db.exceptions.item_process.ItemProcessError[source]¶ Bases:
ExceptionGeneral exception for processing instances of
ItemBaseclass.
-
exception
save_to_db.exceptions.item_process.ItemRevertError[source]¶ Bases:
save_to_db.exceptions.item_process.ItemProcessErrorGeneral exception for converting processed field values of instances of
ItemBaseclass. into json encadable values
-
exception
save_to_db.exceptions.item_process.MergeItemsNotTheSame[source]¶ Bases:
save_to_db.exceptions.item_process.ItemProcessErrorRaised when two items have the same values of one of its getter groups but not the same.
-
exception
save_to_db.exceptions.item_process.MergeMultipleItemsMatch[source]¶ Bases:
save_to_db.exceptions.item_process.ItemProcessErrorRaised when multiple items match the same model during merging.
Note
Even if two items contain the same data, they still considered different if there are other two items that point to them using one-to-x relationship and cannot be merged.
Merge models policy exceptions¶
This module contains exceptions for
MergePolicy class.
-
exception
save_to_db.exceptions.merge_policy.MergePolicyException[source]¶ Bases:
ExceptionGeneral exception for
MergePolicyclass.
-
exception
save_to_db.exceptions.merge_policy.ModelClsAlreadyRegistered[source]¶ Bases:
save_to_db.exceptions.merge_policy.MergePolicyExceptionRaised when trying to add ORM model class to a merge policu twice.
-
exception
save_to_db.exceptions.merge_policy.UnknownModelDefaultKey[source]¶ Bases:
save_to_db.exceptions.merge_policy.MergePolicyExceptionRaised when trying to set defaults for merge policy using unkown default key.
-
exception
save_to_db.exceptions.merge_policy.UnknownRelationFieldNames[source]¶ Bases:
save_to_db.exceptions.merge_policy.MergePolicyExceptionRaised when trying to setup merge policy using unknown relation relationship field name.
Scope exceptions¶
This module contains exceptions for Scope
class.
-
exception
save_to_db.exceptions.scope_except.ItemClsAlreadyScoped[source]¶ Bases:
save_to_db.exceptions.scope_except.ScopeExceptionRaised when an already scoped item is scoped again.
-
exception
save_to_db.exceptions.scope_except.ScopeException[source]¶ Bases:
ExceptionGeneral exception for
Scopeclass.
-
exception
save_to_db.exceptions.scope_except.ScopeIdCannotBeNone[source]¶ Bases:
save_to_db.exceptions.scope_except.ScopeExceptionRaised when trying to set Scope collection_id to None.