@@ -1590,6 +1590,7 @@ def update_many(
15901590 sync : Optional [bool ] = None ,
15911591 silent : bool = False ,
15921592 refill_index_caches : Optional [bool ] = None ,
1593+ raise_on_document_error : bool = False ,
15931594 ) -> Result [Union [bool , List [Union [Json , ArangoServerError ]]]]:
15941595 """Update multiple documents.
15951596
@@ -1599,7 +1600,8 @@ def update_many(
15991600 returned as an object in the result list. It is up to you to
16001601 inspect the list to determine which documents were updated
16011602 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).
16031605
16041606 .. note::
16051607
@@ -1636,6 +1638,11 @@ def update_many(
16361638 index caches if document operations affect the edge index or
16371639 cache-enabled persistent indexes.
16381640 :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
16391646 :return: List of document metadata (e.g. document keys, revisions) and
16401647 any exceptions, or True if parameter **silent** was set to True.
16411648 :rtype: [dict | ArangoError] | bool
@@ -1689,6 +1696,9 @@ def response_handler(
16891696 else : # pragma: no cover
16901697 error = DocumentUpdateError (sub_resp , request )
16911698
1699+ if raise_on_document_error :
1700+ raise error
1701+
16921702 results .append (error )
16931703
16941704 return results
0 commit comments