mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-16 07:10:29 +05:30
15 lines
548 B
Kotlin
15 lines
548 B
Kotlin
package com.github.libretube.util
|
|
|
|
import com.github.libretube.helpers.PreferenceHelper
|
|
|
|
class ExceptionHandler(
|
|
private val defaultExceptionHandler: Thread.UncaughtExceptionHandler?
|
|
) : Thread.UncaughtExceptionHandler {
|
|
override fun uncaughtException(thread: Thread, exc: Throwable) {
|
|
// save the error log
|
|
PreferenceHelper.saveErrorLog(exc.stackTraceToString())
|
|
// throw the exception with the default exception handler to make the app crash
|
|
defaultExceptionHandler?.uncaughtException(thread, exc)
|
|
}
|
|
}
|