mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 08:27:04 +00:00
Merge pull request #3006 from vitorpamplona/claude/add-thread-name-crashes-HsFy0
Include thread name in crash reports
This commit is contained in:
+9
-1
@@ -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(" ")
|
||||
|
||||
+2
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user