Enable more lints (#91642)

This commit is contained in:
Ian Hickson
2021-10-14 22:03:03 -07:00
committed by GitHub
parent 9570d353b3
commit 299d484903
42 changed files with 138 additions and 87 deletions

View File

@@ -54,6 +54,8 @@ Future<vms.VmService> _waitAndConnect(
await service.getVersion();
return service;
} catch (e) {
// We should not be catching all errors arbitrarily here, this might hide real errors.
// TODO(ianh): Determine which exceptions to catch here.
await socket.close();
if (attempts > 5) {
_log.warning('It is taking an unusually long time to connect to the VM...');

View File

@@ -679,14 +679,13 @@ class _SshPortForwarder implements PortForwarder {
/// If successful returns a valid [ServerSocket] (which must be disconnected
/// later).
static Future<ServerSocket?> _createLocalSocket() async {
ServerSocket s;
try {
s = await ServerSocket.bind(_ipv4Loopback, 0);
return await ServerSocket.bind(_ipv4Loopback, 0);
} catch (e) {
// Failures are signaled by a return value of 0 from this function.
// We should not be catching all errors arbitrarily here, this might hide real errors.
// TODO(ianh): Determine which exceptions to catch here.
_log.warning('_createLocalSocket failed: $e');
return null;
}
return s;
}
}