Package com.mongodb
Class MongoWriteConcernException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.mongodb.MongoException
com.mongodb.MongoServerException
com.mongodb.MongoWriteConcernException
- All Implemented Interfaces:
Serializable
An exception indicating a failure to apply the write concern to the requested write operation
- Since:
- 3.0
- See Also:
-
Field Summary
Fields inherited from class com.mongodb.MongoException
TRANSIENT_TRANSACTION_ERROR_LABEL, UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
-
Constructor Summary
ConstructorDescriptionMongoWriteConcernException
(WriteConcernError writeConcernError, ServerAddress serverAddress) Construct an instance.MongoWriteConcernException
(WriteConcernError writeConcernError, WriteConcernResult writeConcernResult, ServerAddress serverAddress) Construct an instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given error label to the exception.Gets the write concern error.Gets the write result.Methods inherited from class com.mongodb.MongoServerException
getErrorCodeName, getServerAddress
Methods inherited from class com.mongodb.MongoException
addLabels, addLabels, fromThrowable, fromThrowableNonNull, getCode, getErrorLabels, hasErrorLabel, removeLabel
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
MongoWriteConcernException
Construct an instance.- Parameters:
writeConcernError
- the non-null write concern errorserverAddress
- the non-null server address
-
MongoWriteConcernException
public MongoWriteConcernException(WriteConcernError writeConcernError, @Nullable WriteConcernResult writeConcernResult, ServerAddress serverAddress) Construct an instance.- Parameters:
writeConcernError
- the non-null write concern errorwriteConcernResult
- the write resultserverAddress
- the non-null server address- Since:
- 3.2
-
-
Method Details
-
addLabel
Description copied from class:MongoException
Adds the given error label to the exception.- Overrides:
addLabel
in classMongoException
- Parameters:
errorLabel
- the non-null error label to add to the exception
-
getWriteConcernError
Gets the write concern error.- Returns:
- the write concern error, which may not be null
-
getWriteResult
Gets the write result.- Returns:
- the write result
- Since:
- 3.2
-