public class MongoCommandException extends MongoServerException
Modifier and Type | Field and Description |
---|---|
private BsonDocument |
response |
private static long |
serialVersionUID |
Constructor and Description |
---|
MongoCommandException(BsonDocument response,
ServerAddress address)
Construct a new instance with the CommandResult from a failed command
|
Modifier and Type | Method and Description |
---|---|
private static int |
extractErrorCode(BsonDocument response) |
private static java.lang.String |
extractErrorMessage(BsonDocument response) |
int |
getErrorCode()
Gets the error code associated with the command failure.
|
java.lang.String |
getErrorMessage()
Gets the error message associated with the command failure.
|
BsonDocument |
getResponse()
For internal use only.
|
private static java.lang.String |
getResponseAsJson(BsonDocument commandResponse) |
getServerAddress
fromThrowable, getCode
private static final long serialVersionUID
private final BsonDocument response
public MongoCommandException(BsonDocument response, ServerAddress address)
response
- the command responseaddress
- the address of the server that generated the responsepublic int getErrorCode()
public java.lang.String getErrorMessage()
public BsonDocument getResponse()
private static java.lang.String getResponseAsJson(BsonDocument commandResponse)
private static int extractErrorCode(BsonDocument response)
private static java.lang.String extractErrorMessage(BsonDocument response)