mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-28 22:03:01 +02:00
Assemble report properties as a table and crash as a code block
This commit is contained in:
@@ -27,65 +27,67 @@ class ReportAssembler {
|
|||||||
fun buildReport(e: Throwable): String =
|
fun buildReport(e: Throwable): String =
|
||||||
buildString {
|
buildString {
|
||||||
append(e.javaClass.simpleName)
|
append(e.javaClass.simpleName)
|
||||||
appendLine()
|
append(": ")
|
||||||
|
|
||||||
// Device and Product Information
|
|
||||||
append("Amethyst Version: ")
|
|
||||||
appendLine(BuildConfig.VERSION_NAME + "-" + BuildConfig.FLAVOR.uppercase())
|
appendLine(BuildConfig.VERSION_NAME + "-" + BuildConfig.FLAVOR.uppercase())
|
||||||
appendLine()
|
appendLine()
|
||||||
|
|
||||||
// Device and Product Information
|
// Device and Product Information
|
||||||
append("Manufacturer: ")
|
appendLine("| Prop | Value |")
|
||||||
appendLine(Build.MANUFACTURER)
|
appendLine("|------|-------|")
|
||||||
append("Model: ")
|
append("| Manuf |")
|
||||||
appendLine(Build.MODEL)
|
append(Build.MANUFACTURER)
|
||||||
append("Product: ")
|
appendLine(" |")
|
||||||
appendLine(Build.PRODUCT)
|
append("| Model |")
|
||||||
appendLine()
|
append(Build.MODEL)
|
||||||
|
appendLine(" |")
|
||||||
|
append("| Prod |")
|
||||||
|
append(Build.PRODUCT)
|
||||||
|
appendLine(" |")
|
||||||
|
|
||||||
// OS Information
|
// OS Information
|
||||||
append("Android Version: ")
|
append("| Android |")
|
||||||
appendLine(Build.VERSION.RELEASE)
|
append(Build.VERSION.RELEASE)
|
||||||
append("SDK Int: ")
|
appendLine(" |")
|
||||||
appendLine(Build.VERSION.SDK_INT.toString())
|
append("| SDK Int |")
|
||||||
append("Build ID: ")
|
append(Build.VERSION.SDK_INT.toString())
|
||||||
appendLine(Build.ID)
|
appendLine(" |")
|
||||||
appendLine()
|
|
||||||
|
|
||||||
// Hardware Information
|
// Hardware Information
|
||||||
append("Brand: ")
|
append("| Brand |")
|
||||||
appendLine(Build.BRAND)
|
append(Build.BRAND)
|
||||||
append("Hardware: ")
|
appendLine(" |")
|
||||||
appendLine(Build.HARDWARE)
|
append("| Hardware |")
|
||||||
appendLine()
|
append(Build.HARDWARE)
|
||||||
|
appendLine(" |")
|
||||||
|
|
||||||
// Other Useful Information
|
// Other Useful Information
|
||||||
append("Device: ")
|
append("| Device | ")
|
||||||
appendLine(Build.DEVICE)
|
append(Build.DEVICE)
|
||||||
append("Host: ")
|
appendLine(" |")
|
||||||
appendLine(Build.HOST)
|
append("| Host | ")
|
||||||
append("User: ")
|
append(Build.HOST)
|
||||||
appendLine(Build.USER)
|
appendLine(" |")
|
||||||
|
append("| User | ")
|
||||||
|
append(Build.USER)
|
||||||
|
appendLine(" |")
|
||||||
appendLine()
|
appendLine()
|
||||||
|
|
||||||
append(e.toString())
|
appendLine("```")
|
||||||
append("\n")
|
appendLine(e.toString())
|
||||||
e.stackTrace.forEach {
|
e.stackTrace.forEach {
|
||||||
append(" ")
|
append(" ")
|
||||||
append(it.toString())
|
appendLine(it.toString())
|
||||||
append("\n")
|
|
||||||
}
|
}
|
||||||
val cause = e.cause
|
val cause = e.cause
|
||||||
if (cause != null) {
|
if (cause != null) {
|
||||||
append("\n\nCause:\n")
|
appendLine("\n\nCause:")
|
||||||
append(" ")
|
append(" ")
|
||||||
append(cause.toString())
|
appendLine(cause.toString())
|
||||||
append("\n")
|
|
||||||
cause.stackTrace.forEach {
|
cause.stackTrace.forEach {
|
||||||
append(" ")
|
append(" ")
|
||||||
append(it.toString())
|
appendLine(it.toString())
|
||||||
append("\n")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
appendLine("```")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user