| 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..60d00449adfa109ac09fba82e95fc8e94e7b9625 100644
|
| --- a/pkg/analysis_server/lib/src/analysis_server.dart
|
| +++ b/pkg/analysis_server/lib/src/analysis_server.dart
|
| @@ -512,7 +512,9 @@ class AnalysisServer {
|
| }
|
| }
|
| channel.sendResponse(new Response.unknownRequest(request));
|
| - }, onError: _sendServerErrorNotification);
|
| + }, onError: (exception, stackTrace) {
|
| + sendServerErrorNotification(exception, stackTrace, fatal: true);
|
| + });
|
| }
|
|
|
| /**
|
| @@ -603,7 +605,7 @@ class AnalysisServer {
|
| 'Unexpected exception during analysis',
|
| new CaughtException(exception, stackTrace));
|
| }
|
| - _sendServerErrorNotification(exception, stackTrace);
|
| + sendServerErrorNotification(exception, stackTrace, fatal: true);
|
| shutdown();
|
| } finally {
|
| if (!operationQueue.isEmpty) {
|
| @@ -627,14 +629,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 +674,32 @@ class AnalysisServer {
|
| }
|
|
|
| /**
|
| + * Sends a `server.error` notification.
|
| + */
|
| + void sendServerErrorNotification(exception, stackTrace, {bool fatal: false}) {
|
| + // 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 +935,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());
|
| - }
|
| }
|
|
|
|
|
|
|