add HttpException to the list of handled exceptions within ResidentWebRunner::run (#153527)

Resolves https://github.com/flutter/flutter/issues/153298, a major crasher of the flutter tool. I plan on cherry-picking this change.

In `ResidentWebRunner::run`, many connection-related exceptions are caught, logged, and have `ToolExit`s thrown in their place ([code](d23be7a07d/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart (L370-L385)), [PR that introduced this](https://github.com/flutter/flutter/pull/50895)). However, `HttpException` is not included in this list. See https://github.com/flutter/flutter/issues/153298#issuecomment-2290900158 for details if interested.
This commit is contained in:
Andrew Kolos
2024-08-16 09:40:19 -07:00
committed by GitHub
parent a0c04534f5
commit 080928dda3
2 changed files with 65 additions and 1 deletions

View File

@@ -383,6 +383,10 @@ Please provide a valid TCP port (an integer between 0 and 65535, inclusive).
appFailedToStart();
_logger.printError('$error', stackTrace: stackTrace);
throwToolExit(kExitMessage);
} on HttpException catch (error, stackTrace) {
appFailedToStart();
_logger.printError('$error', stackTrace: stackTrace);
throwToolExit(kExitMessage);
} on Exception {
appFailedToStart();
rethrow;