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

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

Issue 1364813003: Error handling for bad `.analysis_options` files. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/context_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 153461af129aaeefebb53c33f8fdbbda063a9dc3..f67cfd00b09851d30a55e2b25f077e899dc72d43 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -14,6 +14,7 @@ import 'package:analysis_server/src/server_options.dart';
import 'package:analysis_server/uri/resolver_provider.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/instrumentation/instrumentation.dart';
+import 'package:analyzer/plugin/options.dart';
import 'package:analyzer/source/analysis_options_provider.dart';
import 'package:analyzer/source/package_map_provider.dart';
import 'package:analyzer/source/package_map_resolver.dart';
@@ -466,6 +467,12 @@ class ContextManagerImpl implements ContextManager {
*/
void processOptionsForContext(
ContextInfo info, Map<String, YamlNode> options) {
+ //TODO(pquitslund): push handling into an options processor plugin contributed to engine.
+ //AnalysisEngine.instance.optionsPlugin.optionsProcessors
+ // .forEach((OptionsProcessor p) => p.optionsProcessed(options));
+ if (options == null) {
+ return;
+ }
YamlMap analyzer = options['analyzer'];
if (analyzer == null) {
// No options for analyzer.
@@ -808,8 +815,18 @@ class ContextManagerImpl implements ContextManager {
ContextInfo parent, Folder folder, File packagespecFile) {
ContextInfo info = new ContextInfo(this, parent, folder, packagespecFile,
normalizedPackageRoots[folder.path]);
- Map<String, YamlNode> options = analysisOptionsProvider.getOptions(folder);
- processOptionsForContext(info, options);
+
+ try {
+ Map<String, YamlNode> options =
+ analysisOptionsProvider.getOptions(folder);
+ processOptionsForContext(info, options);
+ } on Exception catch (e) {
+ // TODO(pquitslund): contribute plugin that sends error notification on options file.
+ // Related test: context_manager_test.test_analysis_options_parse_failure()
+ // AnalysisEngine.instance.optionsPlugin.optionsProcessors
+ // .forEach((OptionsProcessor p) => p.onError(e));
+ }
+
FolderDisposition disposition;
List<String> dependencies = <String>[];
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698