[shuttle_p]
[网络接口失败添加错误处理]
This commit is contained in:
yangyakun
2024-01-18 17:10:48 +08:00
parent 7e95e4de92
commit 657fb9eb29
4 changed files with 8 additions and 5 deletions

View File

@@ -14,5 +14,8 @@ public interface OchCommonServiceCallback< T > {
default void onError() {
}
default void onError(String msg) {
}
}

View File

@@ -25,7 +25,7 @@ class OchCommonSubscribeImpl<T : BaseData>(
override fun onError(e: Throwable) {
super.onError(e)
CallerLogger.e("$flavorTag$TAG", "$apiName: onError() ${e.message}")
callback?.onError()
callback?.onError("$apiName: onError() ${e.message}")
}
override fun onError(message: String, code: Int) {

View File

@@ -77,9 +77,9 @@ object TicketModel : StateChangeListener {
}
}
override fun onError() {
super.onError()
ScannerChainLogManager.writeChainLog(TAG +"onError","接口请求错误orderNo${orderNo}__uid${uid}")
override fun onError(message: String) {
ScannerChainLogManager.writeChainLog(TAG +"onError","/och-vehicle/api/scanner/device/writeOff接口请求错误orderNo${orderNo}__uid${uid}__reaseon:${message}")
sendMessage2Driver("网络错误")
}
}
)

View File

@@ -106,7 +106,7 @@ object PassengerServiceManager {
ticketInfo
)
.transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus"))
.subscribe(OchCommonSubscribeImpl(context, callback, "writeOff"))
}
}