mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
catch ChromeDebugException from dwds (#43390)
This commit is contained in:
parent
dee4232d0c
commit
c1d3ca07fe
@ -5,6 +5,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:build_daemon/client.dart';
|
||||
import 'package:dwds/dwds.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:vm_service/vm_service.dart' as vmservice;
|
||||
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart' hide StackTrace;
|
||||
@ -229,6 +230,10 @@ class ResidentWebRunner extends ResidentRunner {
|
||||
throwToolExit('Failed to connect to WebSocket.');
|
||||
} on BuildException {
|
||||
throwToolExit('Failed to build application for the Web.');
|
||||
} on ChromeDebugException catch (err, stackTrace) {
|
||||
throwToolExit(
|
||||
'Failed to establish connection with Chrome. Try running the application again.\n'
|
||||
'If this problem persists, please file an issue with the details below:\n$err\n$stackTrace');
|
||||
} on SocketException catch (err) {
|
||||
throwToolExit(err.toString());
|
||||
} on StateError catch (err) {
|
||||
|
@ -584,6 +584,25 @@ void main() {
|
||||
await expectation;
|
||||
}));
|
||||
|
||||
test('Successfully turns ChromeDebugError 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 ChromeDebugException(<String, dynamic>{});
|
||||
}));
|
||||
return ConnectionResult(mockAppConnection, mockDebugConnection);
|
||||
});
|
||||
|
||||
final Future<void> expectation = expectLater(() => residentWebRunner.run(
|
||||
connectionInfoCompleter: connectionInfoCompleter,
|
||||
), throwsA(isInstanceOf<ToolExit>()));
|
||||
|
||||
unhandledErrorCompleter.complete();
|
||||
await expectation;
|
||||
}));
|
||||
|
||||
test('Successfully turns OptionsSkew error into ToolExit', () => testbed.run(() async {
|
||||
_setupMocks();
|
||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||
|
Loading…
Reference in New Issue
Block a user