Modify replace app errors info's display text "null" to "unknown" in AppErrorsInfoBean

This commit is contained in:
2022-10-01 03:52:00 +08:00
parent e8990f50f9
commit c47d356e4c

View File

@@ -66,20 +66,20 @@ data class AppErrorsInfoBean(
fun clone(packageName: String?, crashInfo: ApplicationErrorReport.CrashInfo?) = fun clone(packageName: String?, crashInfo: ApplicationErrorReport.CrashInfo?) =
(crashInfo?.exceptionClassName?.lowercase() == "native crash").let { isNativeCrash -> (crashInfo?.exceptionClassName?.lowercase() == "native crash").let { isNativeCrash ->
AppErrorsInfoBean( AppErrorsInfoBean(
packageName = packageName ?: "null", packageName = packageName ?: "unknown",
isNativeCrash = isNativeCrash, isNativeCrash = isNativeCrash,
exceptionClassName = crashInfo?.exceptionClassName ?: "null", exceptionClassName = crashInfo?.exceptionClassName ?: "unknown",
exceptionMessage = if (isNativeCrash) crashInfo?.stackTrace.let { exceptionMessage = if (isNativeCrash) crashInfo?.stackTrace.let {
if (it?.contains(other = "Abort message: '") == true) if (it?.contains(other = "Abort message: '") == true)
runCatching { it.split("Abort message: '")[1].split("'")[0] }.getOrNull() runCatching { it.split("Abort message: '")[1].split("'")[0] }.getOrNull()
?: crashInfo?.exceptionMessage ?: "null" ?: crashInfo?.exceptionMessage ?: "unknown"
else crashInfo?.exceptionMessage ?: "null" else crashInfo?.exceptionMessage ?: "unknown"
} else crashInfo?.exceptionMessage ?: "null", } else crashInfo?.exceptionMessage ?: "unknown",
throwFileName = crashInfo?.throwFileName ?: "null", throwFileName = crashInfo?.throwFileName ?: "unknown",
throwClassName = crashInfo?.throwClassName ?: "null", throwClassName = crashInfo?.throwClassName ?: "unknown",
throwMethodName = crashInfo?.throwMethodName ?: "null", throwMethodName = crashInfo?.throwMethodName ?: "unknown",
throwLineNumber = crashInfo?.throwLineNumber ?: -1, throwLineNumber = crashInfo?.throwLineNumber ?: -1,
stackTrace = crashInfo?.stackTrace?.trim() ?: "null", stackTrace = crashInfo?.stackTrace?.trim() ?: "unknown",
timestamp = System.currentTimeMillis() timestamp = System.currentTimeMillis()
) )
} }