2022-08-01 14:52:08 +05:30
|
|
|
package com.github.libretube.util
|
|
|
|
|
2022-08-02 16:35:27 +05:30
|
|
|
class ExceptionHandler(
|
|
|
|
private val defaultExceptionHandler: Thread.UncaughtExceptionHandler?
|
|
|
|
) : Thread.UncaughtExceptionHandler {
|
2022-08-01 14:52:08 +05:30
|
|
|
override fun uncaughtException(thread: Thread, exc: Throwable) {
|
2022-08-02 16:35:27 +05:30
|
|
|
// save the error log
|
2022-08-01 14:52:08 +05:30
|
|
|
PreferenceHelper.saveErrorLog(exc.stackTraceToString())
|
2022-08-02 16:35:27 +05:30
|
|
|
// throw the exception with the default exception handler to make the app crash
|
|
|
|
defaultExceptionHandler?.uncaughtException(thread, exc)
|
2022-08-01 14:52:08 +05:30
|
|
|
}
|
|
|
|
}
|