2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 02:05:29 +00:00

Re-integrate sentry.io

This commit is contained in:
Oliver Walters
2021-02-25 19:51:51 +11:00
parent feaafe068d
commit 90a74fec16
5 changed files with 194 additions and 0 deletions

View File

@ -1,3 +1,7 @@
import 'dart:async';
import 'dart:io';
import 'package:InvenTree/inventree/sentry.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@ -6,11 +10,42 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:one_context/one_context.dart';
import 'dsn.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
void main() async {
await Sentry.init((options) {
options.dsn = SENTRY_DSN_KEY;
},
//appRunner: () => runApp(InvenTreeApp())
);
await runZonedGuarded<Future<void>>(() async {
WidgetsFlutterBinding.ensureInitialized();
// This captures errors reported by the Flutter framework.
FlutterError.onError = (FlutterErrorDetails details) async {
if (isInDebugMode()) {
// In development mode simply print to console.
FlutterError.dumpErrorToConsole(details);
} else {
// In production mode report to the application zone to report to
// Sentry.
Zone.current.handleUncaughtError(details.exception, details.stack);
}
};
runApp(InvenTreeApp());
}, (Object error, StackTrace stackTrace) {
sentryReportError(error, stackTrace);
});
}
class InvenTreeApp extends StatelessWidget {