Skip to content

Commit

Permalink
disable sentry in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangtian616 committed Apr 15, 2022
1 parent c2bddeb commit e54922c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/src/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ void main() async {
FlutterError.onError = (FlutterErrorDetails details) {
Log.error(details.exception, null, details.stack);
FirebaseCrashlytics.instance.recordFlutterError(details);
Sentry.captureException(details.exception, stackTrace: details.stack);
if (!kDebugMode) {
Sentry.captureException(details.exception, stackTrace: details.stack);
}
};

runZonedGuarded(() async {
Expand All @@ -46,7 +48,9 @@ void main() async {
}, (Object error, StackTrace stack) {
Log.error(error, null, stack);
FirebaseCrashlytics.instance.recordError(error, stack);
Sentry.captureException(error, stackTrace: stack);
if (!kDebugMode) {
Sentry.captureException(error, stackTrace: stack);
}
});
}

Expand Down Expand Up @@ -83,7 +87,7 @@ Future<void> init() async {
try {
dsn = await rootBundle.loadString('assets/sentry_dsn');
} catch (_) {}
if (dsn != null) {
if (dsn != null && !kDebugMode) {
await SentryFlutter.init((options) => options.dsn = dsn);
}

Expand Down

0 comments on commit e54922c

Please sign in to comment.