Reland: [flutter_tool] Where possible, catch only subtypes of Exception (#52021)

* Reland: [flutter_tool] Where possible, catch only subtypes of Exception

* Add armv7f to getIOSArchForName
This commit is contained in:
Zachary Anderson
2020-03-06 10:22:12 -08:00
committed by GitHub
parent 2294d75bfa
commit 6c408a0567
83 changed files with 307 additions and 203 deletions

View File

@@ -139,7 +139,8 @@ Future<void> expectToolExitLater(Future<dynamic> future, Matcher messageMatcher)
fail('ToolExit expected, but nothing thrown');
} on ToolExit catch(e) {
expect(e.message, messageMatcher);
} catch(e, trace) {
// Catch all exceptions to give a better test failure message.
} catch (e, trace) { // ignore: avoid_catches_without_on_clauses
fail('ToolExit expected, got $e\n$trace');
}
}

View File

@@ -151,7 +151,8 @@ void testUsingContext(
return await testMethod();
},
);
} catch (error) {
// This catch rethrows, so doesn't need to catch only Exception.
} catch (error) { // ignore: avoid_catches_without_on_clauses
_printBufferedErrors(context);
rethrow;
}

View File

@@ -398,7 +398,8 @@ class MemoryIOSink implements IOSink {
(List<int> data) {
try {
add(data);
} catch (err, stack) {
// Catches all exceptions to propagate them to the completer.
} catch (err, stack) { // ignore: avoid_catches_without_on_clauses
sub.cancel();
completer.completeError(err, stack);
}