Serializable
DuplicateKeyException
public class WriteConcernException extends MongoServerException
Constructor | Description |
---|---|
WriteConcernException(BsonDocument response,
ServerAddress address,
WriteConcernResult writeConcernResult) |
Construct a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
static int |
extractErrorCode(BsonDocument response) |
For internal use only: extract the error code from the response to a write command.
|
static String |
extractErrorMessage(BsonDocument response) |
For internal use only: extract the error message from the response to a write command.
|
int |
getErrorCode() |
Gets the error code associated with the write concern failure.
|
String |
getErrorMessage() |
Gets the error message associated with the write concern failure.
|
BsonDocument |
getResponse() |
Gets the response to the write operation.
|
WriteConcernResult |
getWriteConcernResult() |
Gets the write result.
|
fromThrowable, fromThrowableNonNull, getCode
getServerAddress
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public WriteConcernException(BsonDocument response, ServerAddress address, WriteConcernResult writeConcernResult)
response
- the response to the write operationaddress
- the address of the server that executed the operationwriteConcernResult
- the write concern resultpublic static int extractErrorCode(BsonDocument response)
response
- the response@Nullable public static String extractErrorMessage(BsonDocument response)
response
- the responsepublic WriteConcernResult getWriteConcernResult()
public int getErrorCode()
@Nullable public String getErrorMessage()
public BsonDocument getResponse()