Commit 37d78753 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Propagate exceptions when parsing invalid JSON received from VM service RPCs (#7222)

The default rpc.Peer constructor was applying a transformer that filters
out these errors.

See https://github.com/flutter/flutter/issues/7174
parent 4f2c6dff
...@@ -9,6 +9,7 @@ import 'dart:io'; ...@@ -9,6 +9,7 @@ import 'dart:io';
import 'package:json_rpc_2/json_rpc_2.dart' as rpc; import 'package:json_rpc_2/json_rpc_2.dart' as rpc;
import 'package:json_rpc_2/error_code.dart' as rpc_error_code; import 'package:json_rpc_2/error_code.dart' as rpc_error_code;
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'package:stream_channel/stream_channel.dart';
import 'package:web_socket_channel/io.dart'; import 'package:web_socket_channel/io.dart';
import 'globals.dart'; import 'globals.dart';
...@@ -32,7 +33,7 @@ class VMService { ...@@ -32,7 +33,7 @@ class VMService {
} catch (e) { } catch (e) {
return new Future<VMService>.error('Failed to connect to $wsUri\n $e'); return new Future<VMService>.error('Failed to connect to $wsUri\n $e');
} }
rpc.Peer peer = new rpc.Peer(new IOWebSocketChannel(ws).cast()); rpc.Peer peer = new rpc.Peer.withoutJson(jsonDocument.bind(new IOWebSocketChannel(ws).cast()));
peer.listen(); peer.listen();
return new VMService._(peer, httpUri, wsUri); return new VMService._(peer, httpUri, wsUri);
} }
......
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