优化
This commit is contained in:
@@ -102,6 +102,7 @@ interface JsExtensions : JsEncodeUtils {
|
|||||||
return kotlin.runCatching {
|
return kotlin.runCatching {
|
||||||
analyzeUrl.getStrResponse().body
|
analyzeUrl.getStrResponse().body
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
|
rhinoContext.ensureActive()
|
||||||
AppLog.put("ajax(${urlStr}) error\n${it.localizedMessage}", it)
|
AppLog.put("ajax(${urlStr}) error\n${it.localizedMessage}", it)
|
||||||
}.getOrElse {
|
}.getOrElse {
|
||||||
it.stackTraceStr
|
it.stackTraceStr
|
||||||
@@ -136,6 +137,7 @@ interface JsExtensions : JsEncodeUtils {
|
|||||||
return kotlin.runCatching {
|
return kotlin.runCatching {
|
||||||
analyzeUrl.getStrResponse()
|
analyzeUrl.getStrResponse()
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
|
rhinoContext.ensureActive()
|
||||||
AppLog.put("connect(${urlStr}) error\n${it.localizedMessage}", it)
|
AppLog.put("connect(${urlStr}) error\n${it.localizedMessage}", it)
|
||||||
}.getOrElse {
|
}.getOrElse {
|
||||||
StrResponse(analyzeUrl.url, it.stackTraceStr)
|
StrResponse(analyzeUrl.url, it.stackTraceStr)
|
||||||
@@ -153,6 +155,7 @@ interface JsExtensions : JsEncodeUtils {
|
|||||||
return kotlin.runCatching {
|
return kotlin.runCatching {
|
||||||
analyzeUrl.getStrResponse()
|
analyzeUrl.getStrResponse()
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
|
rhinoContext.ensureActive()
|
||||||
AppLog.put("ajax($urlStr,$header) error\n${it.localizedMessage}", it)
|
AppLog.put("ajax($urlStr,$header) error\n${it.localizedMessage}", it)
|
||||||
}.getOrElse {
|
}.getOrElse {
|
||||||
StrResponse(analyzeUrl.url, it.stackTraceStr)
|
StrResponse(analyzeUrl.url, it.stackTraceStr)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import io.legado.app.utils.isJson
|
|||||||
import io.legado.app.utils.printOnDebug
|
import io.legado.app.utils.printOnDebug
|
||||||
import io.legado.app.utils.splitNotBlank
|
import io.legado.app.utils.splitNotBlank
|
||||||
import io.legado.app.utils.stackTraceStr
|
import io.legado.app.utils.stackTraceStr
|
||||||
|
import kotlinx.coroutines.ensureActive
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withTimeout
|
import kotlinx.coroutines.withTimeout
|
||||||
import org.apache.commons.text.StringEscapeUtils
|
import org.apache.commons.text.StringEscapeUtils
|
||||||
@@ -794,6 +795,7 @@ class AnalyzeRule(
|
|||||||
return kotlin.runCatching {
|
return kotlin.runCatching {
|
||||||
analyzeUrl.getStrResponse().body
|
analyzeUrl.getStrResponse().body
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
|
coroutineContext.ensureActive()
|
||||||
log("ajax(${urlStr}) error\n${it.stackTraceToString()}")
|
log("ajax(${urlStr}) error\n${it.stackTraceToString()}")
|
||||||
it.printOnDebug()
|
it.printOnDebug()
|
||||||
}.getOrElse {
|
}.getOrElse {
|
||||||
|
|||||||
Reference in New Issue
Block a user