浏览代码

1、新增网络错误判断

guanxinyi 1 年之前
父节点
当前提交
756eadee37
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      lib/client_base.dart

+ 4 - 2
lib/client_base.dart

@@ -1,5 +1,6 @@
 import 'dart:convert';
 import 'package:dio/dio.dart' as dio;
+import 'package:fis_common/http/http_error.dart';
 import 'package:flutter/foundation.dart';
 import 'exception.dart';
 import 'http_pool.dart';
@@ -77,8 +78,9 @@ class JsonRpcClientBase {
 
       result = await _handleDecoded(response);
     } catch (e) {
-      await _handleHttpRequestError(JsonRpcNetworkException(e.toString()));
-      // throw JsonRpcException(message: "Http error", data: e);
+      if (e is FHttpError)
+        await _handleHttpRequestError(JsonRpcNetworkException(e.toString()));
+      throw JsonRpcException(message: "Http error", data: e);
     }
     return result;
   }