[flutter_tool] Where possible, catch only subtypes of Exception (#51440)

This commit is contained in:
Zachary Anderson
2020-02-26 21:45:02 -08:00
committed by GitHub
parent 80619f100f
commit f1cd47ef5c
84 changed files with 308 additions and 204 deletions

View File

@@ -180,7 +180,8 @@ class _DefaultPub implements Pub {
retry: true,
);
status.stop();
} catch (exception) {
// The exception is rethrown, so don't catch only Exceptions.
} catch (exception) { // ignore: avoid_catches_without_on_clauses
status.cancel();
rethrow;
}
@@ -322,7 +323,7 @@ class _DefaultPub implements Pub {
globals.stdio.addStdoutStream(process.stdout),
globals.stdio.addStderrStream(process.stderr),
]);
} catch (err, stack) {
} on Exception catch (err, stack) {
globals.printTrace('Echoing stdout or stderr from the pub subprocess failed:');
globals.printTrace('$err\n$stack');
}