Commit 134ccd49 authored by shiyl's avatar shiyl

数据解析代码块进行异常捕获,防止线上问题

parent f6f0c2b9
...@@ -3,6 +3,9 @@ package com.yidian.bcommon.constant ...@@ -3,6 +3,9 @@ package com.yidian.bcommon.constant
/** /**
* 运行配置,提供切换运行环境的能力(变量配置) * 运行配置,提供切换运行环境的能力(变量配置)
*
* ⚠️⚠️注意:对于使用包名注册的三方SDK,目前不支持使用RunConfig切换,需要使用Flavor进行区分
* 例如:高德地图
*/ */
object RunConfig { object RunConfig {
......
...@@ -54,6 +54,7 @@ class HttpParamsUtils { ...@@ -54,6 +54,7 @@ class HttpParamsUtils {
decodeResult.reason = res.reason decodeResult.reason = res.reason
decodeResult.status = res.status decodeResult.status = res.status
if (rsaResult != null) { if (rsaResult != null) {
try {// 捕获数据解析异常, 防止T内部的字端解析失败
if (RunConfig.IS_ENCRYPT) { if (RunConfig.IS_ENCRYPT) {
val result = BCommonManager.getEncryptIml().rsaDecrypt(rsaResult as String) val result = BCommonManager.getEncryptIml().rsaDecrypt(rsaResult as String)
Timber.tag(BCommonManager.TAG_HTTP).d("response result: $result") Timber.tag(BCommonManager.TAG_HTTP).d("response result: $result")
...@@ -74,6 +75,9 @@ class HttpParamsUtils { ...@@ -74,6 +75,9 @@ class HttpParamsUtils {
decodeResult.result = gson.fromJson<T>(resultJson, type) decodeResult.result = gson.fromJson<T>(resultJson, type)
return decodeResult return decodeResult
} }
} catch (e: Exception) {
e.printStackTrace()
}
} }
return decodeResult return decodeResult
} }
......
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