From 076afb3303cb5228b1fbf1f3d0bc7eb6ebde80dc Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Wed, 25 Sep 2019 17:38:00 +0200 Subject: [PATCH] Do not log "No address associated with hostname" exceptions We log all exceptions to Firebase. It's time to start clearing out the ones that do not matter. --- lib/apis/git.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/apis/git.dart b/lib/apis/git.dart index 4dbd1ee1..81d736a3 100644 --- a/lib/apis/git.dart +++ b/lib/apis/git.dart @@ -9,11 +9,20 @@ import 'package:flutter_crashlytics/flutter_crashlytics.dart'; const _platform = const MethodChannel('gitjournal.io/git'); +bool shouldIgnorePlatformException(PlatformException ex) { + if (ex.message.contains("failed to resolve address for")) { + return true; + } + return false; +} + Future invokePlatformMethod(String method, [dynamic arguments]) async { try { return await _platform.invokeMethod(method, arguments); } on PlatformException catch (e, stacktrace) { - await FlutterCrashlytics().logException(e, stacktrace); + if (!shouldIgnorePlatformException(e)) { + await FlutterCrashlytics().logException(e, stacktrace); + } throw e; } }