[flutter_tool] Where possible, catch only subtypes of Exception (#51440)
This commit is contained in:
@@ -211,7 +211,7 @@ class ChromeLauncher {
|
||||
if (!skipCheck) {
|
||||
try {
|
||||
await chrome.chromeConnection.getTabs();
|
||||
} catch (e) {
|
||||
} on Exception catch (e) {
|
||||
await chrome.close();
|
||||
throwToolExit(
|
||||
'Unable to connect to Chrome debug port: ${chrome.debugPort}\n $e');
|
||||
@@ -235,7 +235,7 @@ class ChromeLauncher {
|
||||
final HttpClientResponse response = await request.close();
|
||||
final List<dynamic> jsonObject = await json.fuse(utf8).decoder.bind(response).single as List<dynamic>;
|
||||
return base.resolve(jsonObject.first['devtoolsFrontendUrl'] as String);
|
||||
} catch (_) {
|
||||
} on Exception {
|
||||
// If we fail to talk to the remote debugger protocol, give up and return
|
||||
// the raw URL rather than crashing.
|
||||
return base;
|
||||
|
||||
@@ -66,7 +66,7 @@ Future<void> buildWeb(
|
||||
}
|
||||
throwToolExit('Failed to compile application for the Web.');
|
||||
}
|
||||
} catch (err) {
|
||||
} on Exception catch (err) {
|
||||
throwToolExit(err.toString());
|
||||
} finally {
|
||||
status.stop();
|
||||
|
||||
Reference in New Issue
Block a user