mirror of
https://github.com/flutter/flutter
synced 2024-10-13 03:32:55 +00:00
catch appInstanceId error from dwds (#42656)
This commit is contained in:
parent
b7773da37b
commit
0dce0c6e30
|
@ -213,6 +213,13 @@ class ResidentWebRunner extends ResidentRunner {
|
|||
throwToolExit('Failed to build application for the Web.');
|
||||
} on SocketException catch (err) {
|
||||
throwToolExit(err.toString());
|
||||
} on StateError catch (err) {
|
||||
// Handle known state error.
|
||||
final String message = err.toString();
|
||||
if (message.contains('Could not connect to application with appInstanceId')) {
|
||||
throwToolExit(message);
|
||||
}
|
||||
rethrow;
|
||||
} finally {
|
||||
buildStatus.stop();
|
||||
}
|
||||
|
|
|
@ -480,6 +480,25 @@ void main() {
|
|||
await expectation;
|
||||
}));
|
||||
|
||||
test('Successfully turns AppInstanceId error into ToolExit', () => testbed.run(() async {
|
||||
_setupMocks();
|
||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||
final Completer<void> unhandledErrorCompleter = Completer<void>();
|
||||
when(mockWebFs.connect(any)).thenAnswer((Invocation _) async {
|
||||
unawaited(unhandledErrorCompleter.future.then((void value) {
|
||||
throw StateError('Could not connect to application with appInstanceId: c0ae0750-ee91-11e9-cea6-35d95a968356');
|
||||
}));
|
||||
return ConnectionResult(mockAppConnection, mockDebugConnection);
|
||||
});
|
||||
|
||||
final Future<void> expectation = expectLater(() => residentWebRunner.run(
|
||||
connectionInfoCompleter: connectionInfoCompleter,
|
||||
), throwsA(isInstanceOf<ToolExit>()));
|
||||
|
||||
unhandledErrorCompleter.complete();
|
||||
await expectation;
|
||||
}));
|
||||
|
||||
test('Rethrows Exception type', () => testbed.run(() async {
|
||||
_setupMocks();
|
||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||
|
|
Loading…
Reference in a new issue