Skip to content

Commit b9d08fc

Browse files
authored
Document exceptions in docstrings (#765)
1 parent a5f2369 commit b9d08fc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pynamodb/models.py

+6
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ def __repr__(self):
356356
def delete(self, condition=None):
357357
"""
358358
Deletes this object from dynamodb
359+
360+
:raises pynamodb.exceptions.DeleteError: If the record can not be deleted
359361
"""
360362
args, kwargs = self._get_save_args(attributes=False, null_check=False)
361363
version_condition = self._handle_version_attribute(kwargs)
@@ -371,6 +373,8 @@ def update(self, actions, condition=None):
371373
372374
:param actions: a list of Action updates to apply
373375
:param condition: an optional Condition on which to update
376+
:raises ModelInstance.DoesNotExist: if the object to be updated does not exist
377+
:raises pynamodb.exceptions.UpdateError: if the `condition` is not met
374378
"""
375379
if not isinstance(actions, list) or len(actions) == 0:
376380
raise TypeError("the value of `actions` is expected to be a non-empty list")
@@ -411,6 +415,7 @@ def refresh(self, consistent_read=False):
411415
Retrieves this object's data from dynamodb and syncs this local object
412416
413417
:param consistent_read: If True, then a consistent read is performed.
418+
:raises ModelInstance.DoesNotExist: if the object to be updated does not exist
414419
"""
415420
args, kwargs = self._get_save_args(attributes=False)
416421
kwargs.setdefault('consistent_read', consistent_read)
@@ -473,6 +478,7 @@ def get(cls,
473478
:param range_key: The range key of the desired item, only used when appropriate.
474479
:param consistent_read
475480
:param attributes_to_get
481+
:raises ModelInstance.DoesNotExist: if the object to be updated does not exist
476482
"""
477483
hash_key, range_key = cls._serialize_keys(hash_key, range_key)
478484

0 commit comments

Comments
 (0)