@@ -1590,6 +1590,7 @@ def update_many(
1590
1590
sync : Optional [bool ] = None ,
1591
1591
silent : bool = False ,
1592
1592
refill_index_caches : Optional [bool ] = None ,
1593
+ raise_on_document_error : bool = False ,
1593
1594
) -> Result [Union [bool , List [Union [Json , ArangoServerError ]]]]:
1594
1595
"""Update multiple documents.
1595
1596
@@ -1599,7 +1600,8 @@ def update_many(
1599
1600
returned as an object in the result list. It is up to you to
1600
1601
inspect the list to determine which documents were updated
1601
1602
successfully (returns document metadata) and which were not
1602
- (returns exception object).
1603
+ (returns exception object). Alternatively, you can rely on
1604
+ setting **raise_on_document_error** to True (defaults to False).
1603
1605
1604
1606
.. note::
1605
1607
@@ -1636,6 +1638,11 @@ def update_many(
1636
1638
index caches if document operations affect the edge index or
1637
1639
cache-enabled persistent indexes.
1638
1640
:type refill_index_caches: bool | None
1641
+ :param raise_on_document_error: Whether to raise if a DocumentRevisionError
1642
+ or a DocumentUpdateError is encountered on an individual document,
1643
+ as opposed to returning the error as an object in the result list.
1644
+ Defaults to False.
1645
+ :type raise_on_document_error: bool
1639
1646
:return: List of document metadata (e.g. document keys, revisions) and
1640
1647
any exceptions, or True if parameter **silent** was set to True.
1641
1648
:rtype: [dict | ArangoError] | bool
@@ -1689,6 +1696,9 @@ def response_handler(
1689
1696
else : # pragma: no cover
1690
1697
error = DocumentUpdateError (sub_resp , request )
1691
1698
1699
+ if raise_on_document_error :
1700
+ raise error
1701
+
1692
1702
results .append (error )
1693
1703
1694
1704
return results
0 commit comments