Dubhe
Committed by GitHub

feat: 添加错误上报功能并引入错误模型类

import 'package:auto_track/auto_track/config/queue.dart';
import 'package:auto_track/auto_track/drag/drag_info.dart';
import 'package:auto_track/auto_track/utils/error_model.dart';
import 'package:auto_track/auto_track/utils/track_model.dart';
import '../click/click_info.dart';
... ... @@ -99,6 +100,10 @@ class Track {
_TrackPlugin.customEvent(type, params);
AutoTrackLogger.getInstance().debug('track custom_event => $params');
}
void reportError(Object error, StackTrace stack) {
_TrackPlugin.customEvent('error', ErrorModel(error: error, stack: stack).toMap());
}
}
class _TrackPlugin {
... ...
class ErrorModel {
final Object error;
final StackTrace stack;
ErrorModel({required this.error, required this.stack});
Map<String, dynamic> toMap() {
return {
'error': error.toString(),
'stack': stack.toString(),
'key': error.runtimeType.toString()
};
}
}
... ...
name: auto_track
description: "Auto Track Plugin"
version: 0.0.3
version: 0.0.4
homepage: https://github.com/epoll-j/auto_track_plugin
environment:
... ...