Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Unified Diff: pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart

Issue 2849253002: Fix bugs found while working on tests (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/plugin/plugin_manager.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart
diff --git a/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart b/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart
index ccca6df97f7d9e9e2034f256cc1ec7c7c62b6cf6..8aa8f72b25d2fc119bb9da4640337788f1448cb1 100644
--- a/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart
+++ b/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart
@@ -9,6 +9,7 @@ import 'dart:isolate';
import 'package:analyzer/instrumentation/instrumentation.dart';
import 'package:analyzer_plugin/channel/channel.dart';
import 'package:analyzer_plugin/protocol/protocol.dart';
+import 'package:analyzer_plugin/protocol/protocol_generated.dart';
/**
* The object that allows a [ServerPlugin] to receive [Request]s and to return
@@ -164,26 +165,36 @@ class ServerIsolateChannel implements ServerCommunicationChannel {
onDone();
});
}
- _isolate = await Isolate.spawnUri(
- pluginUri, <String>[], _receivePort.sendPort,
- onError: _errorPort?.sendPort,
- onExit: _exitPort?.sendPort,
- packageConfig: packagesUri);
+ try {
+ _isolate = await Isolate.spawnUri(
+ pluginUri, <String>[], _receivePort.sendPort,
+ onError: _errorPort?.sendPort,
+ onExit: _exitPort?.sendPort,
+ packageConfig: packagesUri);
+ } catch (exception, stackTrace) {
+ instrumentationService.logPluginError(
+ new PluginData(pluginUri.toString(), null, null),
+ RequestErrorCode.PLUGIN_ERROR.toString(),
+ exception.toString(),
+ stackTrace.toString());
+ if (onDone != null) {
+ onDone();
+ }
+ close();
+ return null;
+ }
Completer<Null> channelReady = new Completer<Null>();
_receivePort.listen((dynamic input) {
if (input is SendPort) {
-// print('[server] Received send port');
_sendPort = input;
channelReady.complete(null);
} else if (input is Map) {
- if (input.containsKey('id') != null) {
+ if (input.containsKey('id')) {
String encodedInput = JSON.encode(input);
-// print('[server] Received response: $encodedInput');
instrumentationService.logPluginResponse(pluginUri, encodedInput);
onResponse(new Response.fromJson(input));
} else if (input.containsKey('event')) {
String encodedInput = JSON.encode(input);
-// print('[server] Received notification: $encodedInput');
instrumentationService.logPluginNotification(pluginUri, encodedInput);
onNotification(new Notification.fromJson(input));
}
« no previous file with comments | « pkg/analysis_server/lib/src/plugin/plugin_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698