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

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: Add messages for all sendServerErrorNotification() invocations. 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..ede78db050ae2b470799a1a87d646b44c92bea34 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,7 @@ class AnalysisServer {
options.enableIncrementalResolutionValidation;
defaultContextOptions.generateImplicitErrors = false;
_noErrorNotification = options.noErrorNotification;
- AnalysisEngine.instance.logger = new AnalysisLogger();
+ AnalysisEngine.instance.logger = new AnalysisLogger(this);
_onAnalysisStartedController = new StreamController.broadcast();
_onFileAnalyzedController = new StreamController.broadcast();
_onPriorityChangeController =
@@ -713,7 +712,11 @@ class AnalysisServer {
channel.sendResponse(new Response.unknownRequest(request));
});
}, onError: (exception, stackTrace) {
- sendServerErrorNotification(exception, stackTrace, fatal: true);
+ sendServerErrorNotification(
+ 'Failed to handle request: ${request.toJson()}',
+ exception,
+ stackTrace,
+ fatal: true);
});
}
@@ -794,12 +797,13 @@ class AnalysisServer {
try {
operation.perform(this);
} catch (exception, stackTrace) {
- AnalysisEngine.instance.logger.logError("${exception}\n${stackTrace}");
+ sendServerErrorNotification(
+ 'Failed to perform operation: $operation', 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 +893,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 +902,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 +921,7 @@ class AnalysisServer {
}
// send the notification
channel.sendNotification(
- new ServerErrorParams(fatal, exceptionString, stackTraceString)
+ new ServerErrorParams(fatal, message, stackTraceString)
.toNotification());
}
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_logger.dart ('k') | pkg/analysis_server/lib/src/domain_completion.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698