Skip to content

Commit

Permalink
Ignore body_might_complete_normally_catch_error violations (#105795)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins authored Jun 16, 2022
1 parent 32b22b8 commit f104be7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ void main() {
final BinaryMessenger delegate = TestDelegate();
final Future<ByteData?>? 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);
Expand Down
12 changes: 10 additions & 2 deletions packages/flutter_tools/lib/src/proxied_devices/devices.dart
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,11 @@ class ProxiedPortForwarder extends DevicePortForwarder {
socket.listen((Uint8List data) {
unawaited(connection.sendRequest('proxy.write', <String, Object>{
'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.
Expand All @@ -537,7 +541,11 @@ class ProxiedPortForwarder extends DevicePortForwarder {
// Send a proxy disconnect event just in case.
unawaited(connection.sendRequest('proxy.disconnect', <String, Object>{
'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
Expand Down
3 changes: 3 additions & 0 deletions packages/flutter_tools/lib/src/vmservice.dart
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ Future<vm_service.VmService> 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)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ Future<ProcessTestResult> 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)');
Expand Down

0 comments on commit f104be7

Please sign in to comment.