Commit ca90656f authored by Dan Rubel's avatar Dan Rubel Committed by GitHub

catch VMService connection exception (#6526)

parent 0b49d81c
......@@ -25,7 +25,12 @@ class VMService {
/// Connect to '127.0.0.1' at [port].
static Future<VMService> connect(int port) async {
Uri uri = new Uri(scheme: 'ws', host: '127.0.0.1', port: port, path: 'ws');
WebSocket ws = await WebSocket.connect(uri.toString());
WebSocket ws;
try {
ws = await WebSocket.connect(uri.toString());
} catch (e) {
return new Future<VMService>.error('Failed to connect to $uri\n $e');
}
rpc.Peer peer = new rpc.Peer(new IOWebSocketChannel(ws).cast());
peer.listen();
Uri httpAddress = new Uri(scheme: 'http', host: '127.0.0.1', port: port);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment