[ tool ] Don't throw StateError when DDS fails to start (#158744)

This started happening after moving DDS to launch from `dart
development-service` rather than `DartDevelopmentService` (see
33b402d24c) . This state error was
originally meant to be thrown when some string parsing failed, but is
currently wrapping the `DartDevelopmentServiceException`.

Fixes https://github.com/flutter/flutter/issues/158537
This commit is contained in:
Ben Konyi
2024-11-14 19:43:15 -05:00
committed by GitHub
parent 34b5c274bb
commit d0bd283734
2 changed files with 0 additions and 70 deletions

View File

@@ -96,22 +96,11 @@ class DartDevelopmentService with DartDevelopmentServiceLocalOperationsMixin {
Artifact.engineDartBinary,
),
);
// Complete the future if the DDS process is null, which happens in
// testing.
unawaited(_ddsInstance!.done.whenComplete(completeFuture));
} on DartDevelopmentServiceException catch (e) {
_logger.printTrace('Warning: Failed to start DDS: ${e.message}');
if (e is ExistingDartDevelopmentServiceException) {
_existingDdsUri = e.ddsUri;
} else {
_logger.printError(
'DDS has failed to start and there is not an existing DDS instance '
'available to connect to. Please file an issue at https://github.com/flutter/flutter/issues '
'with the following error message:\n\n ${e.message}.');
// DDS was unable to start for an unknown reason. Raise a StateError
// so it can be reported by the crash reporter.
throw StateError(e.message);
}
completeFuture();
rethrow;