Package com.mongodb

Class MongoServerException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
MongoBulkWriteException, MongoCommandException, MongoWriteConcernException, MongoWriteException, WriteConcernException

public abstract class MongoServerException extends MongoException
An exception indicating that some error has been raised by a MongoDB server in response to an operation.
Since:
2.13
  • Constructor Details

    • MongoServerException

      public MongoServerException(String message, ServerAddress serverAddress)
      Construct a new instance.
      Parameters:
      message - the message from the server
      serverAddress - the address of the server
    • MongoServerException

      public MongoServerException(int code, String message, ServerAddress serverAddress)
      Construct a new instance.
      Parameters:
      code - the error code from the server
      message - the message from the server
      serverAddress - the address of the server
    • MongoServerException

      public MongoServerException(int code, @Nullable String errorCodeName, String message, ServerAddress serverAddress)
      Construct a new instance.
      Parameters:
      code - the error code from the server
      errorCodeName - the error code name from the server
      message - the message from the server
      serverAddress - the address of the server
      Since:
      4.6
  • Method Details

    • getServerAddress

      public ServerAddress getServerAddress()
      Gets the address of the server.
      Returns:
      the address
    • getErrorCodeName

      @Nullable public String getErrorCodeName()
      Get the error code name, which may be null
      Returns:
      the error code nam
      Since:
      4.6
      Since server release
      3.4