Skip to content

Commit f86ca0c

Browse files
committed
[flutter_tools] Suppress error logging for failedToStartError in resident web runner
1 parent a0fba14 commit f86ca0c

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

‎packages/flutter_tools/lib/src/isolated/resident_web_runner.dart‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,9 @@ class ResidentWebRunner extends ResidentRunner {
410410
// The application may have started shutting down before DDS was able to finish establishing
411411
// its connection to DWDS. Don't treat this as an unhandled exception.
412412
appFailedToStart();
413-
_logger.printError(error.toString(), stackTrace: stackTrace);
413+
if (error.errorCode != DartDevelopmentServiceException.failedToStartError) {
414+
_logger.printError(error.message, stackTrace: stackTrace);
415+
}
414416
throwToolExit(kExitMessage);
415417
} on Exception {
416418
appFailedToStart();

‎packages/flutter_tools/test/general.shard/resident_web_runner_test.dart‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,14 @@ name: my_app
275275
'Does not crash if the application exits during DDS startup',
276276
() async {
277277
// Regression test for https://github.com/flutter/flutter/issues/178151
278-
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
278+
final logger = BufferLogger.test();
279+
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice, logger: logger);
279280
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
280281
setupMocks();
281282
webDevFS.exception = DartDevelopmentServiceException.failedToStart();
282283

283284
await expectLater(residentWebRunner.run(), throwsToolExit());
285+
expect(logger.errorText, isEmpty);
284286
},
285287
overrides: <Type, Generator>{
286288
FileSystem: () => fileSystem,
@@ -292,15 +294,17 @@ name: my_app
292294
testUsingContext(
293295
'Does not crash if DDS fails to upgrade WebSocket during startup',
294296
() async {
295-
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
297+
final logger = BufferLogger.test();
298+
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice, logger: logger);
296299
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
297300
setupMocks();
298-
webDevFS.exception = DartDevelopmentServiceException.connectionIssue(
299-
'WebSocketChannelException: WebSocketException: Connection to '
300-
"'http://127.0.0.1:62932/9fVOXxsamo0=/ws#' was not upgraded to websocket",
301-
);
301+
const errorMessage =
302+
'WebSocketChannelException: WebSocketException: Connection to '
303+
"'http://127.0.0.1:62932/9fVOXxsamo0=/ws#' was not upgraded to websocket";
304+
webDevFS.exception = DartDevelopmentServiceException.connectionIssue(errorMessage);
302305

303306
await expectLater(residentWebRunner.run(), throwsToolExit());
307+
expect(logger.errorText, contains(errorMessage));
304308
},
305309
overrides: <Type, Generator>{
306310
FileSystem: () => fileSystem,

0 commit comments

Comments
 (0)