Merge pull request #3006 from vitorpamplona/claude/add-thread-name-crashes-HsFy0

Include thread name in crash reports
This commit is contained in:
Vitor Pamplona
2026-05-20 10:10:44 -04:00
committed by GitHub
2 changed files with 11 additions and 2 deletions
@@ -24,7 +24,10 @@ import android.os.Build
import com.vitorpamplona.amethyst.BuildConfig
class ReportAssembler {
fun buildReport(e: Throwable): String =
fun buildReport(
e: Throwable,
threadName: String = Thread.currentThread().name,
): String =
buildString {
append(e.javaClass.simpleName)
append(": ")
@@ -70,9 +73,14 @@ class ReportAssembler {
append("| User | ")
append(Build.USER)
appendLine(" |")
append("| Thread | ")
append(threadName)
appendLine(" |")
appendLine()
appendLine("```")
append("Thread: ")
appendLine(threadName)
appendLine(e.toString())
e.stackTrace.forEach {
append(" ")
@@ -35,8 +35,9 @@ class UnexpectedCrashSaver(
) {
if (e !is OutOfMemoryError) {
// OOM reports are junk
val threadName = t.name
scope.launch {
cache.writeReport(ReportAssembler().buildReport(e))
cache.writeReport(ReportAssembler().buildReport(e, threadName))
}
}
defaultUEH!!.uncaughtException(t, e)