Browse Source

打印try catch日志;

maqiang 7 months ago
parent
commit
0b610e635f

+ 3 - 0
lib/model/num_converter.dart

@@ -1,5 +1,7 @@
1 1
 import 'package:json_annotation/json_annotation.dart';
2 2
 
3
+import '../main.dart';
4
+
3 5
 /// Json解析num类型
4 6
 class NumConverter extends JsonConverter<num?, dynamic> {
5 7
   const NumConverter();
@@ -13,6 +15,7 @@ class NumConverter extends JsonConverter<num?, dynamic> {
13 15
       try {
14 16
         return num.parse(json);
15 17
       } catch (e) {
18
+        logger.e(e);
16 19
         return null;
17 20
       }
18 21
     }

+ 2 - 4
lib/page/login/login_page.dart

@@ -12,13 +12,10 @@ import 'package:lszlgl/service/user_service.dart';
12 12
 import 'package:lszlgl/widget/button.dart';
13 13
 
14 14
 import '../../config/reresh_config.dart';
15
-import '../../drfit/database.dart';
16 15
 import '../../network/base_dio.dart';
17 16
 import '../../utils/location_utils.dart';
18 17
 import '../../utils/sp_utils.dart';
19 18
 import 'package:lszlgl/service/print_service.dart';
20
-import 'package:path_provider/path_provider.dart';
21
-import 'package:path/path.dart' as p;
22 19
 
23 20
 /// 登录页面
24 21
 class LoginPage extends StatefulWidget {
@@ -46,7 +43,8 @@ class _LoginPageState extends BaseLifecycleState<LoginPage> {
46 43
       await UserService.get().saveLogin(login.data);
47 44
       getSystemData();
48 45
     } on DioException catch (_) {
49
-    } catch (_) {
46
+    } catch (e) {
47
+      logger.e(e);
50 48
       MyNavigator.showToast('获取数据失败');
51 49
     }
52 50
     MyNavigator.dismissLoading();

+ 1 - 2
lib/page/sample_task/reap_sample_detail/reap_sample_task_page.dart

@@ -19,11 +19,9 @@ import 'package:lszlgl/page/signature/signature_page.dart';
19 19
 import '../../../base/base_vm.dart';
20 20
 import '../../../main.dart';
21 21
 import '../../../network/my_api.dart';
22
-import '../../../plugin/bluetooth_plugin.dart';
23 22
 import '../../../utils/file_utils.dart';
24 23
 import '../../../widget/button.dart';
25 24
 import '../../../widget/page_widget.dart';
26
-import 'dart:ui' as ui;
27 25
 
28 26
 class ReapSampleTaskPageArgs {
29 27
   final bool detail;
@@ -144,6 +142,7 @@ class _ReapSampleTaskPageState extends BaseLifecycleState<ReapSampleTaskPage> wi
144 142
         pageStatus.update(pageStatus.value.success(data: data));
145 143
       }
146 144
     } catch (e) {
145
+      logger.e(e);
147 146
       pageStatus.update(pageStatus.value.error());
148 147
     }
149 148
   }

+ 2 - 0
lib/page/sample_task/sample_task_list_page.dart

@@ -14,6 +14,7 @@ import 'package:lszlgl/utils/inject.dart';
14 14
 import 'package:lszlgl/widget/button.dart';
15 15
 import 'package:lszlgl/widget/page_widget.dart';
16 16
 
17
+import '../../main.dart';
17 18
 import 'reap_sample_detail/reap_sample_task_page.dart';
18 19
 import 'stock_sample_detail/stock_sample_task_page.dart';
19 20
 
@@ -79,6 +80,7 @@ class _SampleTaskListPageState extends BaseLifecycleState<SampleTaskListPage> wi
79 80
         vm.refreshAll();
80 81
       }
81 82
     } catch (e) {
83
+      logger.e(e);
82 84
       MyNavigator.dismissLoading();
83 85
     }
84 86
   }

+ 5 - 1
lib/page/sample_task/stock_sample_detail/stock_sample_task_page.dart

@@ -5,6 +5,7 @@ import 'package:lszlgl/config/colors.dart';
5 5
 import 'package:lszlgl/model/rsp/sample_task_rsp.dart';
6 6
 
7 7
 import '../../../base/base_vm.dart';
8
+import '../../../main.dart';
8 9
 import '../../../network/my_api.dart';
9 10
 import '../../../widget/button.dart';
10 11
 import '../../../widget/page_widget.dart';
@@ -83,7 +84,9 @@ class _StockSampleTaskPageState extends BaseLifecycleState<StockSampleTaskPage>
83 84
       } else {
84 85
         MyNavigator.showToast('提交失败');
85 86
       }
86
-    } catch (e) {}
87
+    } catch (e) {
88
+      logger.e(e);
89
+    }
87 90
     MyNavigator.dismissLoading();
88 91
   }
89 92
 
@@ -100,6 +103,7 @@ class _StockSampleTaskPageState extends BaseLifecycleState<StockSampleTaskPage>
100 103
         pageStatus.update(pageStatus.value.success(data: data));
101 104
       }
102 105
     } catch (e) {
106
+      logger.e(e);
103 107
       pageStatus.update(pageStatus.value.error());
104 108
     }
105 109
   }

+ 4 - 1
lib/page/user_center/user_center_page.dart

@@ -7,6 +7,7 @@ import 'package:lszlgl/model/rsp/user_rsp.dart';
7 7
 import 'package:lszlgl/service/user_service.dart';
8 8
 import 'package:lszlgl/widget/card_item.dart';
9 9
 
10
+import '../../main.dart';
10 11
 import '../../network/my_api.dart';
11 12
 
12 13
 /// 用户中心
@@ -33,7 +34,9 @@ class _UserCenterPageState extends BaseLifecycleState<UserCenterPage> with Autom
33 34
       var value = await MyApi.get().userProfile();
34 35
       if (value.data != null) userNotify.value = value.data;
35 36
       await UserService.get().saveUser(value.data);
36
-    } catch (err) {}
37
+    } catch (e) {
38
+      logger.e(e);
39
+    }
37 40
   }
38 41
 
39 42
   @override

+ 1 - 0
lib/service/upgrade_service.dart

@@ -80,6 +80,7 @@ class UpgradeService {
80 80
         }
81 81
       }
82 82
     } catch (e) {
83
+      logger.e(e);
83 84
       if (showLoading) MyNavigator.dismissLoading();
84 85
     }
85 86
     checking = false;