|
@@ -6,6 +6,10 @@ import 'http_pool.dart';
|
|
|
import 'interceptor.dart';
|
|
|
import 'request.dart';
|
|
|
|
|
|
+// ignore: unused_element
|
|
|
+const _C_DIO_FUTURE_ERR_MSG = "Future already completed";
|
|
|
+const _C_DIO_FUTURE_ERR_KEYWORDS = "browser_adapter";
|
|
|
+
|
|
|
/// JSON-RPC Client 基类
|
|
|
class JsonRpcClientBase {
|
|
|
/// 服务主机地址
|
|
@@ -78,6 +82,13 @@ class JsonRpcClientBase {
|
|
|
return response.data;
|
|
|
} on dio.DioError catch (e) {
|
|
|
throw JsonRpcException(message: "Http error", data: e);
|
|
|
+ } on StateError catch (e) {
|
|
|
+ if (e.message == _C_DIO_FUTURE_ERR_MSG) {
|
|
|
+ if (e.stackTrace != null &&
|
|
|
+ e.stackTrace.toString().contains(_C_DIO_FUTURE_ERR_KEYWORDS)) {
|
|
|
+ // don't rethrow
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|