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

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

Issue 419833004: Send 'server.error' notification in case of an exception during performing an operation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | « no previous file | pkg/analysis_server/lib/src/protocol.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e3f7878fa792eb106e0e3c459f00ba026b86851c..4af85c45c10a9e7910b206a64738b4fee8298fbc 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -26,6 +26,7 @@ import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/generated/java_engine.dart';
+import 'package:analysis_services/constants.dart';
import 'package:analysis_services/index/index.dart';
import 'package:analysis_services/search/search_engine.dart';
import 'package:analyzer/src/generated/element.dart';
@@ -401,6 +402,7 @@ class AnalysisServer {
'Unexpected exception during analysis',
new CaughtException(exception, stackTrace));
}
+ _sendServerErrorNotification(exception, stackTrace);
} finally {
if (!operationQueue.isEmpty) {
_schedulePerformOperation();
@@ -734,6 +736,32 @@ class AnalysisServer {
void _schedulePerformOperation() {
new Future(performOperation);
}
+
+ /**
+ * Sends a non-fatal `server.error` notification.
+ */
+ void _sendServerErrorNotification(exception, stackTrace) {
+ // prepare exception.toString()
+ String exceptionString;
+ if (exception != null) {
+ exceptionString = exception.toString();
+ } else {
+ exceptionString = 'null exception';
+ }
+ // prepare stackTrace.toString()
+ String stackTraceString;
+ if (stackTrace != null) {
+ stackTraceString = stackTrace.toString();
+ } else {
+ stackTraceString = 'null stackTrace';
+ }
+ // send the notification
+ Notification notification = new Notification(SERVER_ERROR);
+ notification.setParameter(FATAL, false);
+ notification.setParameter(MESSAGE, exceptionString);
+ notification.setParameter(STACK_TRACE, stackTraceString);
+ channel.sendNotification(notification);
+ }
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/protocol.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698