2023-12-11 01:20:32 -08:00
|
|
|
@file:Suppress("ktlint:standard:filename")
|
2022-06-22 02:48:19 -07:00
|
|
|
|
2022-05-31 09:38:02 -07:00
|
|
|
package co.electriccoin.zcash.crash
|
|
|
|
|
|
|
|
import co.electriccoin.zcash.spackle.io.writeAtomically
|
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
|
import kotlinx.coroutines.withContext
|
|
|
|
import java.io.File
|
|
|
|
|
|
|
|
suspend fun ReportableException.write(path: File) {
|
2023-12-11 01:20:32 -08:00
|
|
|
val exceptionString =
|
|
|
|
buildString {
|
|
|
|
appendLine("App version: $appVersion")
|
|
|
|
appendLine("Is uncaught: $isUncaught")
|
|
|
|
appendLine("Time: $time")
|
|
|
|
append(exceptionTrace)
|
|
|
|
}
|
2022-05-31 09:38:02 -07:00
|
|
|
|
|
|
|
withContext(Dispatchers.IO) {
|
|
|
|
path.writeAtomically { tempFile ->
|
|
|
|
tempFile.writeText(exceptionString)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|