From f104be7ae9df0642308fdeb74e067f6bc60fe0c7 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 16 Jun 2022 16:12:06 -0700 Subject: [PATCH] Ignore body_might_complete_normally_catch_error violations (#105795) --- .../lib/src/test_default_binary_messenger.dart | 3 +++ .../test/test_default_binary_messenger_test.dart | 3 +++ .../lib/src/proxied_devices/devices.dart | 12 ++++++++++-- packages/flutter_tools/lib/src/vmservice.dart | 3 +++ .../integration.shard/overall_experience_test.dart | 6 +++++- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/packages/flutter_test/lib/src/test_default_binary_messenger.dart b/packages/flutter_test/lib/src/test_default_binary_messenger.dart index 9b83bb20261e..4d1265a85013 100644 --- a/packages/flutter_test/lib/src/test_default_binary_messenger.dart +++ b/packages/flutter_test/lib/src/test_default_binary_messenger.dart @@ -141,6 +141,9 @@ class TestDefaultBinaryMessenger extends BinaryMessenger { if (resultFuture != null) { _pendingMessages.add(resultFuture); resultFuture + // TODO(srawlins): Fix this static issue, + // https://github.com/flutter/flutter/issues/105750. + // ignore: body_might_complete_normally_catch_error .catchError((Object error) { /* errors are the responsibility of the caller */ }) .whenComplete(() => _pendingMessages.remove(resultFuture)); } diff --git a/packages/flutter_test/test/test_default_binary_messenger_test.dart b/packages/flutter_test/test/test_default_binary_messenger_test.dart index 30ed9e686bd4..116dee33a098 100644 --- a/packages/flutter_test/test/test_default_binary_messenger_test.dart +++ b/packages/flutter_test/test/test_default_binary_messenger_test.dart @@ -45,6 +45,9 @@ void main() { final BinaryMessenger delegate = TestDelegate(); final Future? future = delegate.send('', null); expect(future, isNotNull); + // TODO(srawlins): Fix this static issue, + // https://github.com/flutter/flutter/issues/105750. + // ignore: body_might_complete_normally_catch_error await future!.catchError((Object error) { }); try { await TestDefaultBinaryMessenger(delegate).send('', null); diff --git a/packages/flutter_tools/lib/src/proxied_devices/devices.dart b/packages/flutter_tools/lib/src/proxied_devices/devices.dart index eebc40ee0735..6b70f84c2b61 100644 --- a/packages/flutter_tools/lib/src/proxied_devices/devices.dart +++ b/packages/flutter_tools/lib/src/proxied_devices/devices.dart @@ -520,7 +520,11 @@ class ProxiedPortForwarder extends DevicePortForwarder { socket.listen((Uint8List data) { unawaited(connection.sendRequest('proxy.write', { 'id': id, - }, data).catchError((Object error, StackTrace stackTrace) { + }, data) + // TODO(srawlins): Fix this static issue, + // https://github.com/flutter/flutter/issues/105750. + // ignore: body_might_complete_normally_catch_error + .catchError((Object error, StackTrace stackTrace) { // Log the error, but proceed normally. Network failure should not // crash the tool. If this is critical, the place where the connection // is being used would crash. @@ -537,7 +541,11 @@ class ProxiedPortForwarder extends DevicePortForwarder { // Send a proxy disconnect event just in case. unawaited(connection.sendRequest('proxy.disconnect', { 'id': id, - }).catchError((Object error, StackTrace stackTrace) { + }) + // TODO(srawlins): Fix this static issue, + // https://github.com/flutter/flutter/issues/105750. + // ignore: body_might_complete_normally_catch_error + .catchError((Object error, StackTrace stackTrace) { // Ignore the error here. There might be a race condition when the // remote end also disconnects. In any case, this request is just to // notify the remote end to disconnect and we should not crash when diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart index 4abc7054054d..a704c8c7063e 100644 --- a/packages/flutter_tools/lib/src/vmservice.dart +++ b/packages/flutter_tools/lib/src/vmservice.dart @@ -288,6 +288,9 @@ Future setUpVmService( // thrown if we're already subscribed. registrationRequests.add(vmService .streamListen(vm_service.EventStreams.kExtension) + // TODO(srawlins): Fix this static issue, + // https://github.com/flutter/flutter/issues/105750. + // ignore: body_might_complete_normally_catch_error .catchError((Object? error) {}, test: (Object? error) => error is vm_service.RPCError) ); } diff --git a/packages/flutter_tools/test/integration.shard/overall_experience_test.dart b/packages/flutter_tools/test/integration.shard/overall_experience_test.dart index 09bb7248dca6..d43da2b545a1 100644 --- a/packages/flutter_tools/test/integration.shard/overall_experience_test.dart +++ b/packages/flutter_tools/test/integration.shard/overall_experience_test.dart @@ -297,7 +297,11 @@ Future runFlutter( } process.stdin.write('q'); return -1; // discarded - }).catchError((Object error) { /* ignore errors here, they will be reported on the next line */ })); + }) + // TODO(srawlins): Fix this static issue, + // https://github.com/flutter/flutter/issues/105750. + // ignore: body_might_complete_normally_catch_error + .catchError((Object error) { /* ignore errors here, they will be reported on the next line */ })); final int exitCode = await process.exitCode; if (streamingLogs) { debugPrint('${stamp()} (process terminated with exit code $exitCode)');