LibreTube/app/src/main/java/com/github/libretube/util/ExceptionHandler.kt

18 lines
568 B
Kotlin
Raw Normal View History

2022-08-01 14:52:08 +05:30
package com.github.libretube.util
import android.util.Log
import com.github.libretube.preferences.PreferenceHelper
import kotlin.system.exitProcess
class ExceptionHandler : Thread.UncaughtExceptionHandler {
override fun uncaughtException(thread: Thread, exc: Throwable) {
Log.e("bnyro", exc.stackTraceToString())
// sav ethe error log
PreferenceHelper.saveErrorLog(exc.stackTraceToString())
// finish the app
System.exit(0)
android.os.Process.killProcess(android.os.Process.myPid())
exitProcess(0)
}
}