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

This reverts commit f1cd47ef5c.
This commit is contained in:
Zachary Anderson
2020-02-26 23:42:19 -08:00
committed by GitHub
parent f1cd47ef5c
commit 483f49962c
84 changed files with 204 additions and 308 deletions

View File

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

View File

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

View File

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