Package com.mongodb
Class MongoServerException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.mongodb.MongoException
com.mongodb.MongoServerException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MongoBulkWriteException
,MongoCommandException
,MongoWriteConcernException
,MongoWriteException
,WriteConcernException
An exception indicating that some error has been raised by a MongoDB server in response to an operation.
- Since:
- 2.13
-
Field Summary
Fields inherited from class com.mongodb.MongoException
TRANSIENT_TRANSACTION_ERROR_LABEL, UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
-
Constructor Summary
ConstructorDescriptionMongoServerException
(int code, String message, ServerAddress serverAddress) Construct a new instance.MongoServerException
(int code, String errorCodeName, String message, ServerAddress serverAddress) Construct a new instance.MongoServerException
(String message, ServerAddress serverAddress) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGet the error code name, which may be nullGets the address of the server.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
-
MongoServerException
Construct a new instance.- Parameters:
message
- the message from the serverserverAddress
- the address of the server
-
MongoServerException
Construct a new instance.- Parameters:
code
- the error code from the servermessage
- the message from the serverserverAddress
- 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 servererrorCodeName
- the error code name from the servermessage
- the message from the serverserverAddress
- the address of the server- Since:
- 4.6
-
-
Method Details
-
getServerAddress
Gets the address of the server.- Returns:
- the address
-
getErrorCodeName
Get the error code name, which may be null- Returns:
- the error code nam
- Since:
- 4.6
- Since server release
- 3.4
-