Package com.mongodb
Class MongoQueryException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.mongodb.MongoException
com.mongodb.MongoServerException
com.mongodb.MongoQueryException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MongoCursorNotFoundException
An exception indicating that a query operation failed on the server.
- Since:
- 3.0
-
Field Summary
Fields inherited from class com.mongodb.MongoException
TRANSIENT_TRANSACTION_ERROR_LABEL, UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
-
Constructor Summary
ConstructorDescriptionMongoQueryException
(MongoCommandException commandException) Construct an instance from a command exception.MongoQueryException
(ServerAddress address, int errorCode, String errorMessage) Construct an instance.MongoQueryException
(ServerAddress address, int errorCode, String errorCodeName, String errorMessage) Construct an instance. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the error code for this query failure.Gets the error message for this query failure.Methods inherited from class com.mongodb.MongoServerException
getErrorCodeName, getServerAddress
Methods inherited from class com.mongodb.MongoException
addLabel, 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
-
MongoQueryException
Construct an instance.- Parameters:
address
- the server addresserrorCode
- the error codeerrorMessage
- the error message
-
MongoQueryException
public MongoQueryException(ServerAddress address, int errorCode, @Nullable String errorCodeName, String errorMessage) Construct an instance.- Parameters:
address
- the server addresserrorCode
- the error codeerrorCodeName
- the error code nameerrorMessage
- the error message- Since:
- 4.6
-
MongoQueryException
Construct an instance from a command exception.- Parameters:
commandException
- the command exception- Since:
- 3.7
-
-
Method Details
-
getErrorCode
public int getErrorCode()Gets the error code for this query failure.- Returns:
- the error code
-
getErrorMessage
Gets the error message for this query failure.- Returns:
- the error message
-