it's a wrapper for db transactional operations ```...
# naming
g
it's a wrapper for db transactional operations
Copy code
internal inline fun <T> runRecoveringTransaction(transaction: () -> T?): T? {
    val result = runCatching { transaction() }
    return result.getOrElse {
        if (it is DataIntegrityViolationException) return null else throw it
    }
}
any suggestions for better name? •
recoverTransaction
-> i think it's a bit generic •
ifRollbackReturnNull
-> a bit weird?
y
returnNullOnRollback
maybe? Or
runWithRollbackHandling
g
Is by any chance
runRecoveringXxx
misleading?
p
Not naming related: a try catch IntegrityException seems simpler