Package com.mongodb
Class ClientBulkWriteException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.mongodb.MongoException
com.mongodb.MongoServerException
com.mongodb.ClientBulkWriteException
- All Implemented Interfaces:
Serializable
The result of an unsuccessful or partially unsuccessful client-level bulk write operation.
Note that the code and labels from this exception are not useful.
An application should use those from the top-level error.
- Since:
- 5.3
- See Also:
-
Field Summary
Fields inherited from class com.mongodb.MongoException
TRANSIENT_TRANSACTION_ERROR_LABEL, UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL -
Constructor Summary
ConstructorsConstructorDescriptionClientBulkWriteException(MongoException error, List<WriteConcernError> writeConcernErrors, Map<Integer, WriteError> writeErrors, ClientBulkWriteResult partialResult, ServerAddress serverAddress) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptiongetCause()The top-level error.The result of the part of a client-level bulk write operation that is known to be successful.TheWriteConcernErrors that occurred while executing the client-level bulk write operation.The indexedWriteErrors.Methods inherited from class com.mongodb.MongoServerException
getErrorCodeName, getServerAddressMethods inherited from class com.mongodb.MongoException
addLabel, addLabels, addLabels, fromThrowable, fromThrowableNonNull, getCode, getErrorLabels, hasErrorLabel, removeLabelMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ClientBulkWriteException
public ClientBulkWriteException(@Nullable MongoException error, @Nullable List<WriteConcernError> writeConcernErrors, @Nullable Map<Integer, WriteError> writeErrors, @Nullable ClientBulkWriteResult partialResult, ServerAddress serverAddress) Constructs a new instance.- Parameters:
error- The top-level error.writeConcernErrors- The write concern errors.writeErrors- The write errors.partialResult- The partial result.serverAddress- The server address. Iferroris aMongoServerExceptionor aMongoSocketException, thenserverAddressmust be equal to theServerAddressthey bear.
-
-
Method Details
-
getCause
The top-level error. That is an error that is neither a write concern error, nor is an error of an individual write operation. -
getWriteConcernErrors
TheWriteConcernErrors that occurred while executing the client-level bulk write operation.There are no guarantees on mutability of the
Listreturned.- Returns:
- The
WriteConcernErrors.
-
getWriteErrors
The indexedWriteErrors. The keys are the indexes of the correspondingClientNamespacedWriteModels in the corresponding client-level bulk write operation.There are no guarantees on mutability or iteration order of the
Mapreturned. -
getPartialResult
The result of the part of a client-level bulk write operation that is known to be successful.- Returns:
- The successful partial result. Present only if the client received a response indicating success of at least one individual write operation.
-