[IC] Fix RecoverableCompilationTransaction wasn't throwing an exception properly
#KT-56052 In Progress
This commit is contained in:
committed by
Space Team
parent
83ea1ca3cf
commit
8825cf7bf6
@@ -240,17 +240,21 @@ class RecoverableCompilationTransaction(
|
||||
|
||||
override fun close() {
|
||||
val mainException = closeCachesManager()
|
||||
|
||||
try {
|
||||
val exceptionToThrow = runCatching {
|
||||
if (isSuccessful) {
|
||||
cleanupStash()
|
||||
} else {
|
||||
revertChanges()
|
||||
cleanupStash()
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
mainException?.addSuppressed(t)
|
||||
throw mainException ?: t
|
||||
}.exceptionOrNull().run {
|
||||
if (this != null) {
|
||||
mainException?.addSuppressed(this)
|
||||
}
|
||||
mainException ?: this
|
||||
}
|
||||
if (exceptionToThrow != null) {
|
||||
throw exceptionToThrow
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user