fix: print stack trace when a patch failed

This commit is contained in:
oSumAtrIX 2023-08-24 23:45:10 +02:00
parent 8dd709b6ef
commit 924c1f80ec
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -19,6 +19,8 @@ import kotlinx.coroutines.runBlocking
import picocli.CommandLine
import picocli.CommandLine.Help.Visibility.ALWAYS
import java.io.File
import java.io.PrintWriter
import java.io.StringWriter
import java.util.logging.Logger
@ -174,7 +176,10 @@ internal object PatchCommand : Runnable {
runBlocking {
apply(false).collect { patchResult ->
patchResult.exception?.let {
logger.severe("${patchResult.patchName} failed:\n${patchResult.exception}")
StringWriter().use { writer ->
it.printStackTrace(PrintWriter(writer))
logger.severe("${patchResult.patchName} failed: $writer")
}
} ?: logger.info("${patchResult.patchName} succeeded")
}
}