优化
Some checks failed
Test Build / prepare (push) Has been cancelled
Test Build / build (app, release) (push) Has been cancelled
Test Build / build (app, releaseA) (push) Has been cancelled
Test Build / prerelease (push) Has been cancelled
Test Build / lanzou (push) Has been cancelled
Test Build / test_Branch (push) Has been cancelled
Test Build / telegram (push) Has been cancelled
update fork / build (push) Has been cancelled
Update Cronet / build (push) Has been cancelled

This commit is contained in:
Horis
2025-04-13 16:03:23 +08:00
parent 87d51adc4a
commit cacffd18c4
2 changed files with 5 additions and 0 deletions

View File

@@ -102,6 +102,7 @@ interface JsExtensions : JsEncodeUtils {
return kotlin.runCatching {
analyzeUrl.getStrResponse().body
}.onFailure {
rhinoContext.ensureActive()
AppLog.put("ajax(${urlStr}) error\n${it.localizedMessage}", it)
}.getOrElse {
it.stackTraceStr
@@ -136,6 +137,7 @@ interface JsExtensions : JsEncodeUtils {
return kotlin.runCatching {
analyzeUrl.getStrResponse()
}.onFailure {
rhinoContext.ensureActive()
AppLog.put("connect(${urlStr}) error\n${it.localizedMessage}", it)
}.getOrElse {
StrResponse(analyzeUrl.url, it.stackTraceStr)
@@ -153,6 +155,7 @@ interface JsExtensions : JsEncodeUtils {
return kotlin.runCatching {
analyzeUrl.getStrResponse()
}.onFailure {
rhinoContext.ensureActive()
AppLog.put("ajax($urlStr,$header) error\n${it.localizedMessage}", it)
}.getOrElse {
StrResponse(analyzeUrl.url, it.stackTraceStr)

View File

@@ -25,6 +25,7 @@ import io.legado.app.utils.isJson
import io.legado.app.utils.printOnDebug
import io.legado.app.utils.splitNotBlank
import io.legado.app.utils.stackTraceStr
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeout
import org.apache.commons.text.StringEscapeUtils
@@ -794,6 +795,7 @@ class AnalyzeRule(
return kotlin.runCatching {
analyzeUrl.getStrResponse().body
}.onFailure {
coroutineContext.ensureActive()
log("ajax(${urlStr}) error\n${it.stackTraceToString()}")
it.printOnDebug()
}.getOrElse {