Exceptions¶
Table of Contents
Adapter exceptions¶
This module contains exceptions for
AdapterBase
class.
-
exception
save_to_db.exceptions.adapter_except.
AdapterException
[source]¶ Bases:
Exception
General exception for
AdapterBase
class.
-
exception
save_to_db.exceptions.adapter_except.
CannotMergeModels
[source]¶ Bases:
save_to_db.exceptions.adapter_except.AdapterException
Raised 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.AdapterException
Raised 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.ItemCollectionException
Raised 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.ItemCollectionException
Raised when trying to create new item class collection with collection_id value already taken.
-
exception
save_to_db.exceptions.item_collection.
ItemCollectionException
[source]¶ Bases:
Exception
General exception for
ItemCollection
class.
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.ItemConfigError
Raised 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.ItemConfigError
Raised 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.ItemConfigError
Raised 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.ItemConfigError
Raised 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.ItemConfigError
Raised when an adapter for a particular item class was not found during class setup.
-
exception
save_to_db.exceptions.item_config.
ItemConfigError
[source]¶ Bases:
Exception
General exception for configuration of
Item
class.
-
exception
save_to_db.exceptions.item_config.
MultipleRelatedItemsFound
[source]¶ Bases:
save_to_db.exceptions.item_config.ItemConfigError
Raised 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
Item
relations, 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.ItemConfigError
Raised 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.ItemConfigError
Raised 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.ItemConfigError
Raised 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.ItemConfigError
Raised 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.ItemConfigError
Raised when:
- A related item was specified using a string path but no item class was found using the path.
- During auto configuration of
Item
class 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.ItemConfigError
Raise 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.ItemFieldError
Raised 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:
ValueError
General exception for
ItemBase
field usage.
-
exception
save_to_db.exceptions.item_field.
WrongAlias
[source]¶ Bases:
save_to_db.exceptions.item_field.ItemFieldError
,KeyError
Raise 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.ItemPersistError
Raise 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.ItemPersistError
Raised when merging two or more ORM models into one is impossible.
-
exception
save_to_db.exceptions.item_persist.
ItemPersistError
[source]¶ Bases:
Exception
General exception for
ItemBase
persistence.
-
exception
save_to_db.exceptions.item_persist.
MultipleModelsMatch
[source]¶ Bases:
save_to_db.exceptions.item_persist.ItemPersistError
Raised 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.ItemPersistError
Raised 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:
Exception
General exception for processing instances of
ItemBase
class.
-
exception
save_to_db.exceptions.item_process.
ItemRevertError
[source]¶ Bases:
save_to_db.exceptions.item_process.ItemProcessError
General exception for converting processed field values of instances of
ItemBase
class. into json encadable values
-
exception
save_to_db.exceptions.item_process.
MergeItemsNotTheSame
(item_one, item_two)[source]¶ Bases:
save_to_db.exceptions.item_process.ItemProcessError
Raised 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.ItemProcessError
Raised 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:
Exception
General exception for
MergePolicy
class.
-
exception
save_to_db.exceptions.merge_policy.
ModelClsAlreadyRegistered
[source]¶ Bases:
save_to_db.exceptions.merge_policy.MergePolicyException
Raised 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.MergePolicyException
Raised 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.MergePolicyException
Raised 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.ScopeException
Raised when an already scoped item is scoped again.
-
exception
save_to_db.exceptions.scope_except.
ScopeException
[source]¶ Bases:
Exception
General exception for
Scope
class.
-
exception
save_to_db.exceptions.scope_except.
ScopeIdCannotBeNone
[source]¶ Bases:
save_to_db.exceptions.scope_except.ScopeException
Raised when trying to set Scope collection_id to None.