Package com.mongodb

Class 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
  • Constructor Details

    • MongoQueryException

      public MongoQueryException(ServerAddress address, int errorCode, String errorMessage)
      Construct an instance.
      Parameters:
      address - the server address
      errorCode - the error code
      errorMessage - the error message
    • MongoQueryException

      public MongoQueryException(ServerAddress address, int errorCode, @Nullable String errorCodeName, String errorMessage)
      Construct an instance.
      Parameters:
      address - the server address
      errorCode - the error code
      errorCodeName - the error code name
      errorMessage - the error message
      Since:
      4.6
    • MongoQueryException

      public MongoQueryException(MongoCommandException commandException)
      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

      public String getErrorMessage()
      Gets the error message for this query failure.
      Returns:
      the error message