|
@@ -101,7 +101,7 @@ scopeNetLife {
|
|
|
|
|
|
override fun <R> onConvert(succeed: Type, response: Response): R? {
|
|
|
try {
|
|
|
- return NetConverter.DEFAULT.onConvert<R>(succeed, response)
|
|
|
+ return NetConverter.onConvert<R>(succeed, response)
|
|
|
} catch (e: ConvertException) {
|
|
|
val code = response.code
|
|
|
when {
|
|
@@ -122,8 +122,8 @@ scopeNetLife {
|
|
|
bodyString.parseBody<R>(succeed)
|
|
|
}
|
|
|
}
|
|
|
- code in 400..499 -> throw RequestParamsException(response) // 请求参数错误
|
|
|
- code >= 500 -> throw ServerResponseException(response) // 服务器异常错误
|
|
|
+ code in 400..499 -> throw RequestParamsException(response, code.toString()) // 请求参数错误
|
|
|
+ code >= 500 -> throw ServerResponseException(response, code.toString()) // 服务器异常错误
|
|
|
else -> throw ConvertException(response)
|
|
|
}
|
|
|
}
|
|
@@ -174,7 +174,7 @@ JSONConvert的核心逻辑
|
|
|
|
|
|
override fun <R> onConvert(succeed: Type, response: Response): R? {
|
|
|
try {
|
|
|
- return NetConverter.DEFAULT.onConvert<R>(succeed, response)
|
|
|
+ return NetConverter.onConvert<R>(succeed, response)
|
|
|
} catch (e: ConvertException) {
|
|
|
val code = response.code
|
|
|
when {
|
|
@@ -196,8 +196,8 @@ JSONConvert的核心逻辑
|
|
|
bodyString.parseBody<R>(kType)
|
|
|
}
|
|
|
}
|
|
|
- code in 400..499 -> throw RequestParamsException(response) // 请求参数错误
|
|
|
- code >= 500 -> throw ServerResponseException(response) // 服务器异常错误
|
|
|
+ code in 400..499 -> throw RequestParamsException(response, code.toString()) // 请求参数错误
|
|
|
+ code >= 500 -> throw ServerResponseException(response, code.toString()) // 服务器异常错误
|
|
|
else -> throw ConvertException(response)
|
|
|
}
|
|
|
}
|