1
0
Эх сурвалжийг харах

fix: 全局取消请求时发生ConvertException错误提示

drake 1 жил өмнө
parent
commit
5a0b71be41

+ 4 - 0
net/src/main/java/com/drake/net/response/ResponseExtension.kt

@@ -162,6 +162,8 @@ fun Response.file(): File? {
 inline fun <reified R> Response.convert(): R {
     try {
         return request.converter().onConvert<R>(typeTokenOf<R>(), this) as R
+    } catch (e: CancellationException) {
+        throw e
     } catch (e: NetException) {
         throw e
     } catch (e: Throwable) {
@@ -179,6 +181,8 @@ inline fun <reified R> Response.convert(): R {
 fun <R> Response.convert(type: Type): R {
     try {
         return request.converter().onConvert<R>(type, this) as R
+    } catch (e: CancellationException) {
+        throw e
     } catch (e: NetException) {
         throw e
     } catch (e: Throwable) {