spring-framework / org.springframework.dao.support / DataAccessUtils / translateIfNecessary

translateIfNecessary

open static fun translateIfNecessary(rawException: RuntimeException, pet: PersistenceExceptionTranslator): RuntimeException

Return a translated exception if this is appropriate, otherwise return the given exception as-is.

Parameters

rawException - an exception that we may wish to translate

pet - PersistenceExceptionTranslator to use to perform the translation

Return
a translated persistence exception if translation is possible, or the raw exception if it is not