Class MongoExceptionTranslator
java.lang.Object
org.springframework.data.mongodb.core.MongoExceptionTranslator
- All Implemented Interfaces:
PersistenceExceptionTranslator
Simple
PersistenceExceptionTranslator
for Mongo. Convert the given runtime exception to an appropriate
exception from the org.springframework.dao
hierarchy. Return null if no translation is
appropriate: any other exception may have resulted from user code, and should not be translated.- Author:
- Oliver Gierke, Michal Vich, Christoph Strobl, Brice Vandeputte
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if a given exception holds an error label indicating a transient failure.
-
Field Details
-
DEFAULT_EXCEPTION_TRANSLATOR
-
-
Constructor Details
-
MongoExceptionTranslator
public MongoExceptionTranslator()
-
-
Method Details
-
translateExceptionIfPossible
- Specified by:
translateExceptionIfPossible
in interfacePersistenceExceptionTranslator
-
isTransientFailure
Check if a given exception holds an error label indicating a transient failure.- Parameters:
e
- the exception to inspect.- Returns:
- true if the given
Exception
is aMongoException
holding one of the transient exception error labels. - Since:
- 4.4
- See Also:
-
MongoException.hasErrorLabel(String)
-