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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 1432423004: Send any logError() information to the IDE. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 458cdd727cbe31e76842fc509844b9dc89ddaec2..c48dc4d914613d13012de9d201f4d423945278e4 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -9,7 +9,6 @@ import 'dart:collection';
import 'dart:core' hide Resource;
import 'dart:math' show max;
-import 'package:analysis_server/plugin/analysis/analyzed_files.dart';
import 'package:analysis_server/plugin/analysis/resolver_provider.dart';
import 'package:analysis_server/plugin/protocol/protocol.dart' hide Element;
import 'package:analysis_server/src/analysis_logger.dart';
@@ -318,7 +317,11 @@ class AnalysisServer {
options.enableIncrementalResolutionValidation;
defaultContextOptions.generateImplicitErrors = false;
_noErrorNotification = options.noErrorNotification;
- AnalysisEngine.instance.logger = new AnalysisLogger();
+ AnalysisEngine.instance.logger = new AnalysisLogger(
+ onError: (String message, CaughtException exception) {
+ sendServerErrorNotification(message, exception, exception?.stackTrace,
+ fatal: false);
+ });
_onAnalysisStartedController = new StreamController.broadcast();
_onFileAnalyzedController = new StreamController.broadcast();
_onPriorityChangeController =
@@ -713,7 +716,7 @@ class AnalysisServer {
channel.sendResponse(new Response.unknownRequest(request));
});
}, onError: (exception, stackTrace) {
- sendServerErrorNotification(exception, stackTrace, fatal: true);
+ sendServerErrorNotification(null, exception, stackTrace, fatal: true);
Brian Wilkerson 2015/11/12 14:52:51 I think we should always provide a message that id
scheglov 2015/11/12 16:15:56 Done.
});
}
@@ -794,12 +797,11 @@ class AnalysisServer {
try {
operation.perform(this);
} catch (exception, stackTrace) {
- AnalysisEngine.instance.logger.logError("${exception}\n${stackTrace}");
+ sendServerErrorNotification(null, exception, stackTrace, fatal: true);
if (rethrowExceptions) {
throw new AnalysisException('Unexpected exception during analysis',
new CaughtException(exception, stackTrace));
}
- sendServerErrorNotification(exception, stackTrace, fatal: true);
shutdown();
} finally {
if (_test_onOperationPerformedCompleter != null) {
@@ -889,7 +891,8 @@ class AnalysisServer {
/**
* Sends a `server.error` notification.
*/
- void sendServerErrorNotification(exception, stackTrace, {bool fatal: false}) {
+ void sendServerErrorNotification(String msg, exception, stackTrace,
+ {bool fatal: false}) {
// prepare exception.toString()
String exceptionString;
if (exception != null) {
@@ -897,6 +900,8 @@ class AnalysisServer {
} else {
exceptionString = 'null exception';
}
+ // prepare message
+ String message = msg != null ? '$msg\n$exceptionString' : exceptionString;
// prepare stackTrace.toString()
String stackTraceString;
if (stackTrace != null) {
@@ -914,7 +919,7 @@ class AnalysisServer {
}
// send the notification
channel.sendNotification(
- new ServerErrorParams(fatal, exceptionString, stackTraceString)
+ new ServerErrorParams(fatal, message, stackTraceString)
.toNotification());
}

Powered by Google App Engine
This is Rietveld 408576698