[Gradle] Restore special handling for OOM as a cause of RemoteException

Fixup to KT-59191
This commit is contained in:
Alexander.Likhachev
2023-06-09 17:43:32 +02:00
parent 441b22c0fd
commit 10285b32f1
@@ -245,12 +245,12 @@ internal class GradleKotlinCompilerWork @Inject constructor(
}
bufferingMessageCollector.flush(messageCollector)
exitCodeFromProcessExitCode(log, res.get())
} catch (e: RemoteException) {
throw DaemonCrashedException(e)
} catch (e: Throwable) {
bufferingMessageCollector.flush(messageCollector)
if (e is OutOfMemoryError || e.hasOOMCause()) {
throw OOMErrorException(kotlinDaemonOOMHelperMessage)
} else if (e is RemoteException) {
throw DaemonCrashedException(e)
} else {
throw e
}