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
public class MongoQueryException extends MongoServerException
An exception indicating that a query operation failed on the server.- Since:
 - 3.0
 - See Also:
 - 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 MongoQueryException(MongoCommandException commandException)Construct an instance from a command exception.MongoQueryException(ServerAddress address, int errorCode, String errorMessage)Construct an instance. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetErrorCode()Gets the error code for this query failure.StringgetErrorMessage()Gets the error message for this query failure.- 
Methods inherited from class com.mongodb.MongoException
addLabel, fromThrowable, fromThrowableNonNull, getCode, getErrorLabels, hasErrorLabel, removeLabel 
- 
Methods inherited from class com.mongodb.MongoServerException
getServerAddress 
- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
- 
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
MongoQueryException
public MongoQueryException(ServerAddress address, int errorCode, String errorMessage)
Construct an instance.- Parameters:
 address- the server addresserrorCode- the error codeerrorMessage- the error message
 
- 
MongoQueryException
public MongoQueryException(MongoCommandException commandException)
Construct an instance from a command exception.- Parameters:
 commandException- the command exception- Since:
 - 3.7
 
 
 - 
 
- 
Method Detail
- 
getErrorCode
public int getErrorCode()
Gets the error code for this query failure.- Returns:
 - the error code
 
 
- 
getErrorMessage
public String getErrorMessage()
Gets the error message for this query failure.- Returns:
 - the error message
 
 
 - 
 
 -