Commit a94a3d82 authored by chenhuaqing's avatar chenhuaqing

error handling for vip expired

parent 8e6f0a36
......@@ -21,6 +21,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import timber.log.Timber
import java.io.File
import java.io.IOException
import java.security.SecureRandom
import java.security.cert.X509Certificate
import java.util.concurrent.Executors
......@@ -83,6 +84,8 @@ object AuthManager {
MMKV.defaultMMKV().putLong("LAST_ACC_TIME", last_acc_time)
}
class AuthException(msg: String) : IOException(msg), BaseService.ExpectedException
suspend fun initAuthProfile(profile: Profile) {
withContext(Dispatchers.IO) {
getLineConfig()?.let {
......
......@@ -124,7 +124,14 @@ class GuardedProcessPool(private val onFatal: suspend (IOException) -> Unit) : C
) {
Guard(cmdSupplier).apply {
launch {
try {
start() // if start fails, IOException will be thrown directly
} catch (ex: Throwable) {
if (ex is AuthManager.AuthException) {
onFatal(ex)
return@launch
}
}
looper(onRestartCallback)
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment