Skip to content

Commit

Permalink
Document exceptions in docstrings (#765)
Browse files Browse the repository at this point in the history
  • Loading branch information
meawoppl committed Apr 8, 2020
1 parent a5f2369 commit b9d08fc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pynamodb/models.py
Expand Up @@ -356,6 +356,8 @@ def __repr__(self):
def delete(self, condition=None):
"""
Deletes this object from dynamodb
:raises pynamodb.exceptions.DeleteError: If the record can not be deleted
"""
args, kwargs = self._get_save_args(attributes=False, null_check=False)
version_condition = self._handle_version_attribute(kwargs)
Expand All @@ -371,6 +373,8 @@ def update(self, actions, condition=None):
:param actions: a list of Action updates to apply
:param condition: an optional Condition on which to update
:raises ModelInstance.DoesNotExist: if the object to be updated does not exist
:raises pynamodb.exceptions.UpdateError: if the `condition` is not met
"""
if not isinstance(actions, list) or len(actions) == 0:
raise TypeError("the value of `actions` is expected to be a non-empty list")
Expand Down Expand Up @@ -411,6 +415,7 @@ def refresh(self, consistent_read=False):
Retrieves this object's data from dynamodb and syncs this local object
:param consistent_read: If True, then a consistent read is performed.
:raises ModelInstance.DoesNotExist: if the object to be updated does not exist
"""
args, kwargs = self._get_save_args(attributes=False)
kwargs.setdefault('consistent_read', consistent_read)
Expand Down Expand Up @@ -473,6 +478,7 @@ def get(cls,
:param range_key: The range key of the desired item, only used when appropriate.
:param consistent_read
:param attributes_to_get
:raises ModelInstance.DoesNotExist: if the object to be updated does not exist
"""
hash_key, range_key = cls._serialize_keys(hash_key, range_key)

Expand Down

0 comments on commit b9d08fc

Please sign in to comment.