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

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

Issue 2546213002: Report analysis exceptions using the 'exceptions' stream or 'completeError'. (Closed)
Patch Set: Created 4 years 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/analyzer/lib/src/dart/analysis/driver.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 3c4eed06b798a10dfb643da5531d0ceffe68b2a4..fb44c7ed1842e3bfbb4c03fa7ef326cb2ef573d6 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -632,8 +632,14 @@ class AnalysisServer {
if (result != null) {
return result;
}
- nd.AnalysisDriver driver = getAnalysisDriver(path);
- return driver?.getResult(path);
+ try {
+ nd.AnalysisDriver driver = getAnalysisDriver(path);
+ return await driver?.getResult(path);
+ } catch (e) {
+ // Ignore the exception.
+ // We don't want to log the same exception again and again.
+ return null;
+ }
}
CompilationUnitElement getCompilationUnitElement(String file) {
@@ -1211,7 +1217,7 @@ class AnalysisServer {
// The result will be produced by the "results" stream with
// the fully resolved unit, and processed with sending analysis
// notifications as it happens after content changes.
- driver.getResult(file);
+ driver.getResult(file).catchError((exception, stackTrace) {});
}
}
return;
@@ -1848,6 +1854,10 @@ class ServerContextManagerCallbacks extends ContextManagerCallbacks {
// OCCURRENCES (not used in IDEA)
// OUTLINE (not used in IDEA)
});
+ analysisDriver.exceptions.listen((nd.ExceptionResult result) {
+ AnalysisEngine.instance.logger
+ .logError('Analysis failed: ${result.path}', result.exception);
+ });
analysisServer.driverMap[folder] = analysisDriver;
return analysisDriver;
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/analysis/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698