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

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

Issue 569743003: update error handling to send response with stack trace (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 3 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 | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/constants.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 c4ca2d2330a7d256fb6cd7d4dea42da5dee2875b..1236eb9f99d5135c3241124678f4db8cbd63f3e3 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -37,8 +37,7 @@ class ServerContextManager extends ContextManager {
*/
AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
- ServerContextManager(
- this.analysisServer, ResourceProvider resourceProvider,
+ ServerContextManager(this.analysisServer, ResourceProvider resourceProvider,
PackageMapProvider packageMapProvider)
: super(resourceProvider, packageMapProvider);
@@ -72,8 +71,8 @@ class ServerContextManager extends ContextManager {
}
@override
- void updateContextPackageMap(Folder contextFolder,
- Map<String, List<Folder>> packageMap) {
+ void updateContextPackageMap(Folder contextFolder, Map<String,
+ List<Folder>> packageMap) {
AnalysisContext context = analysisServer.folderMap[contextFolder];
context.sourceFactory = _createSourceFactory(packageMap);
analysisServer.schedulePerformAnalysisOperation(context);
@@ -87,8 +86,7 @@ class ServerContextManager extends ContextManager {
List<UriResolver> resolvers = <UriResolver>[
new DartUriResolver(analysisServer.defaultSdk),
new ResourceUriResolver(resourceProvider),
- new PackageMapUriResolver(resourceProvider, packageMap)
- ];
+ new PackageMapUriResolver(resourceProvider, packageMap)];
return new SourceFactory(resolvers);
}
}
@@ -234,8 +232,8 @@ class AnalysisServer {
{this.rethrowExceptions: true}) {
searchEngine = createSearchEngine(index);
operationQueue = new ServerOperationQueue(this);
- contextDirectoryManager = new ServerContextManager(
- this, resourceProvider, packageMapProvider);
+ contextDirectoryManager =
+ new ServerContextManager(this, resourceProvider, packageMapProvider);
AnalysisEngine.instance.logger = new AnalysisLogger();
running = true;
Notification notification = new ServerConnectedParams().toNotification();
@@ -298,8 +296,8 @@ class AnalysisServer {
if (unanalyzed.isNotEmpty) {
StringBuffer buffer = new StringBuffer();
buffer.writeAll(unanalyzed, ', ');
- throw new RequestFailure(new Response.unanalyzedPriorityFiles(request,
- buffer.toString()));
+ throw new RequestFailure(
+ new Response.unanalyzedPriorityFiles(request, buffer.toString()));
}
folderMap.forEach((Folder folder, AnalysisContext context) {
List<Source> sourceList = sourceMap[context];
@@ -319,7 +317,8 @@ class AnalysisServer {
// Update existing contexts.
//
folderMap.forEach((Folder folder, AnalysisContext context) {
- AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(context.analysisOptions);
+ AnalysisOptionsImpl options =
+ new AnalysisOptionsImpl.con1(context.analysisOptions);
optionUpdaters.forEach((OptionUpdater optionUpdater) {
optionUpdater(options);
});
@@ -405,9 +404,12 @@ class AnalysisServer {
channel.sendResponse(exception.response);
return;
} catch (exception, stackTrace) {
- _sendServerErrorNotification(exception, stackTrace);
- RequestError error =
- new RequestError(RequestErrorCode.SERVER_ERROR, 'Server Error');
+ RequestError error = new RequestError(
+ RequestErrorCode.SERVER_ERROR,
+ exception);
+ if (stackTrace != null) {
+ error.stackTrace = stackTrace.toString();
+ }
Response response = new Response(request.id, error: error);
channel.sendResponse(response);
return;
@@ -520,8 +522,8 @@ class AnalysisServer {
}
statusAnalyzing = isAnalyzing;
AnalysisStatus analysis = new AnalysisStatus(isAnalyzing);
- channel.sendNotification(new ServerStatusParams(
- analysis: analysis).toNotification());
+ channel.sendNotification(
+ new ServerStatusParams(analysis: analysis).toNotification());
}
/**
@@ -536,15 +538,13 @@ class AnalysisServer {
* So, we can start working in parallel on adding services and improving
* projects/contexts support.
*/
- void setAnalysisRoots(String requestId,
- List<String> includedPaths,
- List<String> excludedPaths) {
+ void setAnalysisRoots(String requestId, List<String> includedPaths,
+ List<String> excludedPaths) {
try {
contextDirectoryManager.setRoots(includedPaths, excludedPaths);
} on UnimplementedError catch (e) {
throw new RequestFailure(
- new Response.unsupportedFeature(
- requestId, e.message));
+ new Response.unsupportedFeature(requestId, e.message));
}
}
@@ -565,16 +565,19 @@ class AnalysisServer {
} else if (change is ChangeContentOverlay) {
// TODO(paulberry): an error should be generated if source is not
// currently in the content cache.
- TimestampedData<String> oldContents = analysisContext.getContents(
- source);
+ TimestampedData<String> oldContents =
+ analysisContext.getContents(source);
String newContents;
try {
- newContents = SourceEdit.applySequence(oldContents.data,
- change.edits);
+ newContents =
+ SourceEdit.applySequence(oldContents.data, change.edits);
} on RangeError {
- throw new RequestFailure(new Response(id, error: new RequestError(
- RequestErrorCode.INVALID_OVERLAY_CHANGE,
- 'Invalid overlay change')));
+ throw new RequestFailure(
+ new Response(
+ id,
+ error: new RequestError(
+ RequestErrorCode.INVALID_OVERLAY_CHANGE,
+ 'Invalid overlay change')));
}
// TODO(paulberry): to aid in incremental processing it would be
// better to use setChangedContents.
@@ -593,11 +596,13 @@ class AnalysisServer {
/**
* Implementation for `analysis.setSubscriptions`.
*/
- void setAnalysisSubscriptions(Map<AnalysisService, Set<String>> subscriptions) {
+ void setAnalysisSubscriptions(Map<AnalysisService,
+ Set<String>> subscriptions) {
// send notifications for already analyzed sources
subscriptions.forEach((service, Set<String> newFiles) {
Set<String> oldFiles = analysisServices[service];
- Set<String> todoFiles = oldFiles != null ? newFiles.difference(oldFiles) : newFiles;
+ Set<String> todoFiles =
+ oldFiles != null ? newFiles.difference(oldFiles) : newFiles;
for (String file in todoFiles) {
Source source = getSource(file);
// prepare context
@@ -607,7 +612,8 @@ class AnalysisServer {
}
// Dart unit notifications.
if (AnalysisEngine.isDartFileName(file)) {
- CompilationUnit dartUnit = getResolvedCompilationUnitToResendNotification(file);
+ CompilationUnit dartUnit =
+ getResolvedCompilationUnitToResendNotification(file);
if (dartUnit != null) {
switch (service) {
case AnalysisService.HIGHLIGHTS:
@@ -621,7 +627,11 @@ class AnalysisServer {
sendAnalysisNotificationOccurrences(this, file, dartUnit);
break;
case AnalysisService.OUTLINE:
- sendAnalysisNotificationOutline(this, context, source, dartUnit);
+ sendAnalysisNotificationOutline(
+ this,
+ context,
+ source,
+ dartUnit);
break;
case AnalysisService.OVERRIDES:
sendAnalysisNotificationOverrides(this, file, dartUnit);
@@ -753,7 +763,8 @@ class AnalysisServer {
Source unitSource = getSource(path);
List<Source> librarySources = context.getLibrariesContaining(unitSource);
for (Source librarySource in librarySources) {
- CompilationUnit unit = context.getResolvedCompilationUnit2(unitSource, librarySource);
+ CompilationUnit unit =
+ context.getResolvedCompilationUnit2(unitSource, librarySource);
if (unit != null) {
units.add(unit);
}
@@ -846,7 +857,7 @@ class AnalysisServer {
* done.
*/
void sendContextAnalysisDoneNotifications(AnalysisContext context,
- AnalysisDoneReason reason) {
+ AnalysisDoneReason reason) {
Completer<AnalysisDoneReason> completer =
contextAnalysisDoneCompleters.remove(context);
if (completer != null) {
@@ -926,8 +937,11 @@ class AnalysisServer {
stackTraceString = 'null stackTrace';
}
// send the notification
- channel.sendNotification(new ServerErrorParams(true, exceptionString,
- stackTraceString).toNotification());
+ channel.sendNotification(
+ new ServerErrorParams(
+ true,
+ exceptionString,
+ stackTraceString).toNotification());
}
}
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/constants.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698