Showing
3 changed files
with
20 additions
and
1 deletions
1 | import 'package:auto_track/auto_track/config/queue.dart'; | 1 | import 'package:auto_track/auto_track/config/queue.dart'; |
2 | import 'package:auto_track/auto_track/drag/drag_info.dart'; | 2 | import 'package:auto_track/auto_track/drag/drag_info.dart'; |
3 | +import 'package:auto_track/auto_track/utils/error_model.dart'; | ||
3 | import 'package:auto_track/auto_track/utils/track_model.dart'; | 4 | import 'package:auto_track/auto_track/utils/track_model.dart'; |
4 | 5 | ||
5 | import '../click/click_info.dart'; | 6 | import '../click/click_info.dart'; |
@@ -99,6 +100,10 @@ class Track { | @@ -99,6 +100,10 @@ class Track { | ||
99 | _TrackPlugin.customEvent(type, params); | 100 | _TrackPlugin.customEvent(type, params); |
100 | AutoTrackLogger.getInstance().debug('track custom_event => $params'); | 101 | AutoTrackLogger.getInstance().debug('track custom_event => $params'); |
101 | } | 102 | } |
103 | + | ||
104 | + void reportError(Object error, StackTrace stack) { | ||
105 | + _TrackPlugin.customEvent('error', ErrorModel(error: error, stack: stack).toMap()); | ||
106 | + } | ||
102 | } | 107 | } |
103 | 108 | ||
104 | class _TrackPlugin { | 109 | class _TrackPlugin { |
lib/auto_track/utils/error_model.dart
0 → 100644
1 | +class ErrorModel { | ||
2 | + final Object error; | ||
3 | + final StackTrace stack; | ||
4 | + | ||
5 | + ErrorModel({required this.error, required this.stack}); | ||
6 | + | ||
7 | + Map<String, dynamic> toMap() { | ||
8 | + return { | ||
9 | + 'error': error.toString(), | ||
10 | + 'stack': stack.toString(), | ||
11 | + 'key': error.runtimeType.toString() | ||
12 | + }; | ||
13 | + } | ||
14 | +} |
-
Please register or login to post a comment