mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 17:29:50 +08:00
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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user