| 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 80cc62451c9a2d77e01ce8c54f0118b3ab94299c..016fe802b30a605b8f9d44ff2441d7937be3b587 100644
|
| --- a/pkg/analysis_server/lib/src/analysis_server.dart
|
| +++ b/pkg/analysis_server/lib/src/analysis_server.dart
|
| @@ -22,6 +22,7 @@ import 'package:analyzer/src/generated/sdk.dart';
|
| import 'package:analyzer/src/generated/sdk_io.dart';
|
| import 'package:analyzer/src/generated/source_io.dart';
|
| import 'package:analysis_server/src/computers.dart';
|
| +import 'package:analyzer/src/generated/java_engine.dart';
|
|
|
|
|
| /**
|
| @@ -126,10 +127,22 @@ class AnalysisServer {
|
| Map<AnalysisService, Set<String>> analysisServices = <AnalysisService, Set<String>>{};
|
|
|
| /**
|
| + * True if any exceptions thrown by analysis should be propagated up the call
|
| + * stack.
|
| + */
|
| + bool rethrowExceptions;
|
| +
|
| + /**
|
| * Initialize a newly created server to receive requests from and send
|
| * responses to the given [channel].
|
| + *
|
| + * If [rethrowExceptions] is true, then any exceptions thrown by analysis are
|
| + * propagated up the call stack. The default is true to allow analysis
|
| + * exceptions to show up in unit tests, but it should be set to false when
|
| + * running a full analysis server.
|
| */
|
| - AnalysisServer(this.channel, ResourceProvider resourceProvider) {
|
| + AnalysisServer(this.channel, ResourceProvider resourceProvider,
|
| + {this.rethrowExceptions: true}) {
|
| contextDirectoryManager = new AnalysisServerContextDirectoryManager(this, resourceProvider);
|
| AnalysisEngine.instance.logger = new AnalysisLogger();
|
| running = true;
|
| @@ -225,6 +238,13 @@ class AnalysisServer {
|
| sendStatusNotification(context.toString());
|
| AnalysisResult result = context.performAnalysisTask();
|
| notices = result.changeNotices;
|
| + } catch (exception, stackTrace) {
|
| + AnalysisEngine.instance.logger.logError("${exception}\n${stackTrace}");
|
| + if (rethrowExceptions) {
|
| + throw new AnalysisException(
|
| + 'Unexpected exception during analysis',
|
| + new CaughtException(exception, stackTrace));
|
| + }
|
| } finally {
|
| if (notices == null) {
|
| // Either we have no more work to do for this context, or there was an
|
| @@ -451,9 +471,7 @@ class AnalysisServer {
|
| }
|
|
|
| void _scheduleTask() {
|
| - new Future(performTask).catchError((ex, st) {
|
| - AnalysisEngine.instance.logger.logError("${ex}\n${st}");
|
| - });
|
| + new Future(performTask);
|
| }
|
| }
|
|
|
|
|