调试书源显示更详细的错误信息

pull/354/head
gedoor 5 years ago
parent 632f48e906
commit ea81350ef4
  1. 5
      app/src/main/java/io/legado/app/help/JsExtensions.kt
  2. 19
      app/src/main/java/io/legado/app/model/Debug.kt
  3. 1
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@ -6,6 +6,7 @@ import io.legado.app.constant.AppConst.dateFormat
import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.utils.EncoderUtils import io.legado.app.utils.EncoderUtils
import io.legado.app.utils.MD5Utils import io.legado.app.utils.MD5Utils
import org.jetbrains.anko.getStackTraceString
import java.net.URLEncoder import java.net.URLEncoder
import java.util.* import java.util.*
@ -23,7 +24,7 @@ interface JsExtensions {
val response = call.execute() val response = call.execute()
response.body() response.body()
} catch (e: Exception) { } catch (e: Exception) {
e.localizedMessage e.getStackTraceString()
} }
} }
@ -34,7 +35,7 @@ interface JsExtensions {
val response = call.execute() val response = call.execute()
response response
} catch (e: Exception) { } catch (e: Exception) {
e.localizedMessage e.getStackTraceString()
} }
} }

@ -7,6 +7,7 @@ import io.legado.app.model.rss.Rss
import io.legado.app.model.webBook.WebBook import io.legado.app.model.webBook.WebBook
import io.legado.app.utils.htmlFormat import io.legado.app.utils.htmlFormat
import io.legado.app.utils.isAbsUrl import io.legado.app.utils.isAbsUrl
import org.jetbrains.anko.getStackTraceString
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
@ -76,7 +77,7 @@ object Debug {
} }
} }
.onError { .onError {
log(debugSource, it.localizedMessage, state = -1) log(debugSource, it.getStackTraceString(), state = -1)
} }
} }
@ -88,7 +89,7 @@ object Debug {
log(debugSource, "︽内容页解析完成", state = 1000) log(debugSource, "︽内容页解析完成", state = 1000)
} }
.onError { .onError {
log(debugSource, it.localizedMessage, state = -1) log(debugSource, it.getStackTraceString(), state = -1)
} }
} }
@ -148,11 +149,7 @@ object Debug {
} }
} }
.onError { .onError {
log( log(debugSource, it.getStackTraceString(), state = -1)
debugSource,
it.localizedMessage,
state = -1
)
} }
tasks.add(explore) tasks.add(explore)
} }
@ -171,7 +168,7 @@ object Debug {
} }
} }
.onError { .onError {
log(debugSource, it.localizedMessage, state = -1) log(debugSource, it.getStackTraceString(), state = -1)
} }
tasks.add(search) tasks.add(search)
} }
@ -185,7 +182,7 @@ object Debug {
tocDebug(webBook, book) tocDebug(webBook, book)
} }
.onError { .onError {
log(debugSource, it.localizedMessage, state = -1) log(debugSource, it.getStackTraceString(), state = -1)
} }
tasks.add(info) tasks.add(info)
} }
@ -204,7 +201,7 @@ object Debug {
} }
} }
.onError { .onError {
log(debugSource, it.localizedMessage, state = -1) log(debugSource, it.getStackTraceString(), state = -1)
} }
tasks.add(chapterList) tasks.add(chapterList)
} }
@ -221,7 +218,7 @@ object Debug {
log(debugSource, "︽正文页解析完成", state = 1000) log(debugSource, "︽正文页解析完成", state = 1000)
} }
.onError { .onError {
log(debugSource, it.localizedMessage, state = -1) log(debugSource, it.getStackTraceString(), state = -1)
} }
tasks.add(content) tasks.add(content)
} }

@ -589,7 +589,6 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
/** /**
* 执行JS * 执行JS
*/ */
@Throws(Exception::class)
private fun evalJS(jsStr: String, result: Any?): Any? { private fun evalJS(jsStr: String, result: Any?): Any? {
try { try {
val bindings = SimpleBindings() val bindings = SimpleBindings()

Loading…
Cancel
Save