fix: Print stack trace of exception

Otherwise the log will not include what originally raised the exception.
This commit is contained in:
oSumAtrIX 2023-09-13 03:58:46 +02:00
parent 9fdb8f087f
commit aa71146b1b
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -164,14 +164,17 @@ class Patcher(
} }
// Recursively execute all dependency patches. // Recursively execute all dependency patches.
patch.dependencies?.forEach { dependencyName -> patch.dependencies?.forEach { dependencyClass ->
val dependency = context.allPatches[dependencyName]!! val dependency = context.allPatches[dependencyClass]!!
val result = executePatch(dependency, executedPatches) val result = executePatch(dependency, executedPatches)
result.exception?.let { result.exception?.let {
return PatchResult( return PatchResult(
patch, patch,
PatchException("'$patchName' depends on '${dependency.name ?: dependency}' that raised an exception:\n$it") PatchException(
"'$patchName' depends on '${dependency.name ?: dependency}' " +
"that raised an exception:\n${it.stackTraceToString()}"
)
) )
} }
} }
@ -245,7 +248,7 @@ class Patcher(
PatchResult( PatchResult(
patch, patch,
PatchException( PatchException(
"'${patch.name}' raised an exception while being closed: $it", "'${patch.name}' raised an exception while being closed: ${it.stackTraceToString()}",
result.exception result.exception
) )
) )