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
public class MongoWriteConcernException extends MongoServerException
An exception indicating a failure to apply the write concern to the requested write operation- Since:
- 3.0
- See Also:
WriteConcern, Serialized Form
-
-
Field Summary
-
Fields inherited from class com.mongodb.MongoException
TRANSIENT_TRANSACTION_ERROR_LABEL, UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
-
-
Constructor Summary
Constructors Constructor Description MongoWriteConcernException(WriteConcernError writeConcernError, ServerAddress serverAddress)Construct an instance.MongoWriteConcernException(WriteConcernError writeConcernError, WriteConcernResult writeConcernResult, ServerAddress serverAddress)Construct an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLabel(String errorLabel)Adds the given error label to the exception.WriteConcernErrorgetWriteConcernError()Gets the write concern error.WriteConcernResultgetWriteResult()Gets the write result.-
Methods inherited from class com.mongodb.MongoServerException
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 Detail
-
MongoWriteConcernException
public MongoWriteConcernException(WriteConcernError writeConcernError, ServerAddress serverAddress)
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 Detail
-
addLabel
public void addLabel(String errorLabel)
Description copied from class:MongoExceptionAdds the given error label to the exception.- Overrides:
addLabelin classMongoException- Parameters:
errorLabel- the non-null error label to add to the exception
-
getWriteConcernError
public WriteConcernError getWriteConcernError()
Gets the write concern error.- Returns:
- the write concern error, which may not be null
-
getWriteResult
public WriteConcernResult getWriteResult()
Gets the write result.- Returns:
- the write result
- Since:
- 3.2
-
-