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

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

Issue 854443002: Catch and report exceptions in computers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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/operation/operation_analysis.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 b1941df1695362aea68544f70e4340feec19b504..318d3d22890e49e4d7d2e586753ffafa61861480 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -512,7 +512,7 @@ class AnalysisServer {
}
}
channel.sendResponse(new Response.unknownRequest(request));
- }, onError: _sendServerErrorNotification);
+ }, onError: sendServerErrorNotification);
}
/**
@@ -603,7 +603,7 @@ class AnalysisServer {
'Unexpected exception during analysis',
new CaughtException(exception, stackTrace));
}
- _sendServerErrorNotification(exception, stackTrace);
+ sendServerErrorNotification(exception, stackTrace);
shutdown();
} finally {
if (!operationQueue.isEmpty) {
@@ -627,14 +627,6 @@ class AnalysisServer {
}
/**
- * Report to the client that the given [exception] was caught with the
- * associated [stackTrace].
- */
- void reportException(dynamic exception, StackTrace stackTrace) {
- _sendServerErrorNotification(exception, stackTrace);
- }
-
- /**
* Schedules execution of the given [ServerOperation].
*/
void scheduleOperation(ServerOperation operation) {
@@ -680,6 +672,32 @@ class AnalysisServer {
}
/**
+ * Sends a `server.error` notification.
+ */
+ void sendServerErrorNotification(exception, stackTrace, {bool fatal: true}) {
Brian Wilkerson 2015/01/13 20:57:37 It looks like "false" is more common than "true".
scheglov 2015/01/13 21:13:51 Done.
+ // 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
+ channel.sendNotification(
+ new ServerErrorParams(
+ fatal,
+ exceptionString,
+ stackTraceString).toNotification());
+ }
+
+ /**
* Send status notification to the client. The `operation` is the operation
* being performed or `null` if analysis is complete.
*/
@@ -915,32 +933,6 @@ class AnalysisServer {
new Future(performOperation);
performOperationPending = true;
}
-
- /**
- * Sends a 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
- channel.sendNotification(
- new ServerErrorParams(
- true,
- exceptionString,
- stackTraceString).toNotification());
- }
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/operation/operation_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698