SerializableMongoChangeStreamException, MongoClientEmbeddedException, MongoClientException, MongoExecutionTimeoutException, MongoGridFSException, MongoIncompatibleDriverException, MongoInternalException, MongoInterruptedException, MongoServerException, MongoSocketExceptionpublic class MongoException extends RuntimeException
| Modifier and Type | Field | Description |
|---|---|---|
static String |
TRANSIENT_TRANSACTION_ERROR_LABEL |
An error label indicating that the exception can be treated as a transient transaction error.
|
static String |
UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL |
An error label indicating that the exception can be treated as an unknown transaction commit result.
|
| Constructor | Description |
|---|---|
MongoException(int code,
String msg) |
|
MongoException(int code,
String msg,
Throwable t) |
|
MongoException(String msg) |
|
MongoException(String msg,
Throwable t) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addLabel(String errorLabel) |
Adds the given error label to the exception.
|
static MongoException |
fromThrowable(Throwable t) |
Static helper to create or cast a MongoException from a throwable
|
static MongoException |
fromThrowableNonNull(Throwable t) |
Static helper to create or cast a MongoException from a throwable
|
int |
getCode() |
Gets the exception code
|
Set<String> |
getErrorLabels() |
Gets the set of error labels associated with this exception.
|
boolean |
hasErrorLabel(String errorLabel) |
Return true if the exception is labelled with the given error label, and false otherwise.
|
void |
removeLabel(String errorLabel) |
Removes the given error label from the exception.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic static final String TRANSIENT_TRANSACTION_ERROR_LABEL
hasErrorLabel(String),
Constant Field Valuespublic static final String UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
hasErrorLabel(String),
Constant Field Valuespublic MongoException(String msg)
msg - the messagepublic MongoException(int code,
String msg)
code - the error codemsg - the messagepublic MongoException(String msg, Throwable t)
msg - the messaget - the throwable cause@Nullable public static MongoException fromThrowable(@Nullable Throwable t)
t - a throwable, which may be nullpublic static MongoException fromThrowableNonNull(Throwable t)
t - a throwable, which may not be nullpublic int getCode()
public void addLabel(String errorLabel)
errorLabel - the non-null error label to add to the exceptionpublic void removeLabel(String errorLabel)
errorLabel - the non-null error label to remove from the exceptionpublic Set<String> getErrorLabels()
public boolean hasErrorLabel(String errorLabel)
errorLabel - the non-null error label