File tree Expand file tree Collapse file tree
src/main/java/co/ec/cnsyn/codecatcher Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ android {
1313 applicationId = " co.ec.cnsyn.codecatcher"
1414 minSdk = 24
1515 targetSdk = 34
16- versionCode = 129
17- versionName = " 1.0.129 "
16+ versionCode = 130
17+ versionName = " 1.0.130 "
1818
1919 testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
2020 vectorDrawables {
Original file line number Diff line number Diff line change @@ -140,5 +140,20 @@ class ExceptionHandler(private val context: Context) : Thread.UncaughtExceptionH
140140 logFile.writeText(" " )
141141 }
142142
143+ fun record (throwable : Throwable ) {
144+ val logDir = getLogDirectory(App .context())
145+ val fileName = " crash_report_${System .currentTimeMillis() / 1000L } .txt"
146+
147+ val file = File (logDir, fileName)
148+ FileOutputStream (file).use { fos ->
149+ PrintWriter (fos).use { writer ->
150+ val sw = StringWriter ()
151+ val pw = PrintWriter (sw)
152+ throwable.printStackTrace(pw)
153+ writer.println (sw.toString())
154+ }
155+ }
156+ }
157+
143158 }
144159}
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import androidx.compose.ui.text.withStyle
1515import androidx.core.view.ViewCompat
1616import androidx.core.view.WindowInsetsCompat
1717import co.ec.cnsyn.codecatcher.App
18+ import co.ec.cnsyn.codecatcher.ExceptionHandler
1819import kotlin.concurrent.thread
1920
2021
@@ -43,10 +44,11 @@ fun <T : Any?> async(
4344 err(e)
4445 }
4546 if (e is NullPointerException ){
46- AppLogger .e(" Async error ${e.stackTrace } " ,e," async" )
47+ AppLogger .e(" Async error ${e.message } " ,e," async" )
4748 } else {
4849 AppLogger .e(" Async error" ,e," async" )
4950 }
51+ ExceptionHandler .record(e)
5052 }
5153 }
5254}
You can’t perform that action at this time.
0 commit comments