Return null instead of empty in Future.catchError callbacks (#72409)

This commit is contained in:
Sam Rawlins
2020-12-16 10:38:04 -08:00
committed by GitHub
parent a3971153f6
commit 0dc80621eb
2 changed files with 6 additions and 3 deletions

View File

@@ -618,7 +618,7 @@ class BrowserManager {
throwToolExit('${runtime.name} exited with code $browserExitCode before connecting.');
}).catchError((dynamic error, StackTrace stackTrace) {
if (completer.isCompleted) {
return;
return null;
}
completer.completeError(error, stackTrace);
}));
@@ -630,7 +630,7 @@ class BrowserManager {
}).catchError((dynamic error, StackTrace stackTrace) {
chrome.close();
if (completer.isCompleted) {
return;
return null;
}
completer.completeError(error, stackTrace);
}));

View File

@@ -179,7 +179,10 @@ abstract class FlutterTestDriver {
// it forcefully and it won't terminate child processes, so we need to ensure
// it's running before terminating.
await resume().timeout(defaultTimeout)
.catchError((Object e) => _debugPrint('Ignoring failure to resume during shutdown'));
.catchError((Object e) {
_debugPrint('Ignoring failure to resume during shutdown');
return null;
});
_debugPrint('Sending SIGTERM to $_processPid..');
io.Process.killPid(_processPid, io.ProcessSignal.sigterm);