Skip to content

Commit

Permalink
fix: Print stack trace of exception
Browse files Browse the repository at this point in the history
Otherwise the log will not include what originally raised the exception.
  • Loading branch information
oSumAtrIX committed Sep 13, 2023
1 parent 9fdb8f0 commit aa71146
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions revanced-patcher/src/main/kotlin/app/revanced/patcher/Patcher.kt
Expand Up @@ -164,14 +164,17 @@ class Patcher(
}

// Recursively execute all dependency patches.
patch.dependencies?.forEach { dependencyName ->
val dependency = context.allPatches[dependencyName]!!
patch.dependencies?.forEach { dependencyClass ->
val dependency = context.allPatches[dependencyClass]!!
val result = executePatch(dependency, executedPatches)

result.exception?.let {
return PatchResult(
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()}"
)
)
}
}
Expand Down Expand Up @@ -245,7 +248,7 @@ class Patcher(
PatchResult(
patch,
PatchException(
"'${patch.name}' raised an exception while being closed: $it",
"'${patch.name}' raised an exception while being closed: ${it.stackTraceToString()}",
result.exception
)
)
Expand Down

0 comments on commit aa71146

Please sign in to comment.