CosmosBatchOperationError Class   
A transactional batch request to the Azure Cosmos database service has failed.
Constructor
CosmosBatchOperationError(error_index=None, headers=None, status_code=None, message=None, operation_responses=None, **kwargs)Parameters
| Name | Description | 
|---|---|
| error_index | Default value: None | 
| headers | Default value: None | 
| status_code | Default value: None | 
| message | Default value: None | 
| operation_responses | Default value: None | 
Examples
Handle a CosmosBatchOperationError:
       batch_operations = [create_item_operation, create_item_operation]
       try:
           container.execute_item_batch(batch_operations, partition_key="Account1")
       except exceptions.CosmosBatchOperationError as e:
           error_operation_index = e.error_index
           error_operation_response = e.operation_responses[error_operation_index]
           error_operation = batch_operations[error_operation_index]
           print("\nError operation: {}, error operation response: {}\n".format(error_operation, error_operation_response))
Variables
| Name | Description | 
|---|---|
| error_index | Index of operation within the batch that caused the error. | 
| headers | Error headers. | 
| status_code | HTTP response code. | 
| message | Error message. | 
| operation_responses | List of failed operations' responses. | 
Methods
| add_note | Exception.add_note(note) – add a note to the exception | 
| raise_with_traceback | Raise the exception with the existing traceback. Deprecated since version 1.22.0: This method is deprecated as we don't support Python 2 anymore. Use raise/from instead. | 
| with_traceback | Exception.with_traceback(tb) – set self.traceback to tb and return self. | 
add_note
Exception.add_note(note) – add a note to the exception
add_note()raise_with_traceback
Raise the exception with the existing traceback.
Deprecated since version 1.22.0: This method is deprecated as we don't support Python 2 anymore. Use raise/from instead.
raise_with_traceback() -> Nonewith_traceback
Exception.with_traceback(tb) – set self.traceback to tb and return self.
with_traceback()