Package com.mongodb
Class MongoException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.mongodb.MongoException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
MongoChangeStreamException
,MongoClientException
,MongoExecutionTimeoutException
,MongoGridFSException
,MongoIncompatibleDriverException
,MongoInternalException
,MongoInterruptedException
,MongoServerException
,MongoSocketException
,MongoWriteConcernWithResponseException
@Deprecated(since="2021-05-27") public class MongoException extends java.lang.RuntimeException
Deprecated.Usage of this API is not supported in AEM as a Cloud Service.Top level Exception for all Exceptions, server-side or client-side, that come from the driver.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TRANSIENT_TRANSACTION_ERROR_LABEL
Deprecated.An error label indicating that the exception can be treated as a transient transaction error.static java.lang.String
UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
Deprecated.An error label indicating that the exception can be treated as an unknown transaction commit result.
-
Constructor Summary
Constructors Constructor Description MongoException(int code, java.lang.String msg)
Deprecated.MongoException(int code, java.lang.String msg, java.lang.Throwable t)
Deprecated.MongoException(java.lang.String msg)
Deprecated.MongoException(java.lang.String msg, java.lang.Throwable t)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addLabel(java.lang.String errorLabel)
Deprecated.Adds the given error label to the exception.static MongoException
fromThrowable(java.lang.Throwable t)
Deprecated.Static helper to create or cast a MongoException from a throwablestatic MongoException
fromThrowableNonNull(java.lang.Throwable t)
Deprecated.Static helper to create or cast a MongoException from a throwableint
getCode()
Deprecated.Gets the exception codejava.util.Set<java.lang.String>
getErrorLabels()
Deprecated.Gets the set of error labels associated with this exception.boolean
hasErrorLabel(java.lang.String errorLabel)
Deprecated.Return true if the exception is labelled with the given error label, and false otherwise.void
removeLabel(java.lang.String errorLabel)
Deprecated.Removes the given error label from the exception.
-
-
-
Field Detail
-
TRANSIENT_TRANSACTION_ERROR_LABEL
public static final java.lang.String TRANSIENT_TRANSACTION_ERROR_LABEL
Deprecated.An error label indicating that the exception can be treated as a transient transaction error.- Since:
- 3.8
- See Also:
hasErrorLabel(String)
, Constant Field Values
-
UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
public static final java.lang.String UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
Deprecated.An error label indicating that the exception can be treated as an unknown transaction commit result.- Since:
- 3.8
- See Also:
hasErrorLabel(String)
, Constant Field Values
-
-
Constructor Detail
-
MongoException
public MongoException(java.lang.String msg)
Deprecated.- Parameters:
msg
- the message
-
MongoException
public MongoException(int code, java.lang.String msg)
Deprecated.- Parameters:
code
- the error codemsg
- the message
-
MongoException
public MongoException(java.lang.String msg, java.lang.Throwable t)
Deprecated.- Parameters:
msg
- the messaget
- the throwable cause
-
MongoException
public MongoException(int code, java.lang.String msg, java.lang.Throwable t)
Deprecated.- Parameters:
code
- the error codemsg
- the messaget
- the throwable cause
-
-
Method Detail
-
fromThrowable
@Nullable public static MongoException fromThrowable(@Nullable java.lang.Throwable t)
Deprecated.Static helper to create or cast a MongoException from a throwable- Parameters:
t
- a throwable, which may be null- Returns:
- a MongoException
-
fromThrowableNonNull
public static MongoException fromThrowableNonNull(java.lang.Throwable t)
Deprecated.Static helper to create or cast a MongoException from a throwable- Parameters:
t
- a throwable, which may not be null- Returns:
- a MongoException
- Since:
- 3.7
-
getCode
public int getCode()
Deprecated.Gets the exception code- Returns:
- the error code.
-
addLabel
public void addLabel(java.lang.String errorLabel)
Deprecated.Adds the given error label to the exception.- Parameters:
errorLabel
- the non-null error label to add to the exception- Since:
- 3.8
-
removeLabel
public void removeLabel(java.lang.String errorLabel)
Deprecated.Removes the given error label from the exception.- Parameters:
errorLabel
- the non-null error label to remove from the exception- Since:
- 3.8
-
getErrorLabels
public java.util.Set<java.lang.String> getErrorLabels()
Deprecated.Gets the set of error labels associated with this exception.- Returns:
- the error labels, which may not be null but may be empty
- Since:
- 3.8
-
hasErrorLabel
public boolean hasErrorLabel(java.lang.String errorLabel)
Deprecated.Return true if the exception is labelled with the given error label, and false otherwise.- Parameters:
errorLabel
- the non-null error label- Returns:
- true if the exception is labelled with the given error label
- Since:
- 3.8
-
-