Index: pkg/analyzer/lib/src/plugin/plugin_configuration.dart |
diff --git a/pkg/analyzer/lib/src/plugin/plugin_configuration.dart b/pkg/analyzer/lib/src/plugin/plugin_configuration.dart |
index b3a1d9061e8b53f6cfc6b8b2ec4d8e17b866978d..6d5a102a80ce607d2c0c128734c51a2fe92c11e3 100644 |
--- a/pkg/analyzer/lib/src/plugin/plugin_configuration.dart |
+++ b/pkg/analyzer/lib/src/plugin/plugin_configuration.dart |
@@ -31,9 +31,6 @@ PluginInfo _processPluginMapping(dynamic name, dynamic details) { |
} |
PluginInfo _processPluginNode(dynamic node) { |
- if (node is String) { |
- return new PluginInfo(name: node); |
- } |
if (node is YamlMap) { |
if (node.length == 1) { |
return new PluginInfo(name: node.keys.first, version: node.values.first); |
@@ -65,9 +62,11 @@ class PluginConfig { |
} |
}); |
} else { |
- var plugin = _processPluginNode(pluginConfig); |
- if (plugin != null) { |
- plugins.add(plugin); |
+ // Anything but an empty list of plugins is treated as a format error. |
+ if (pluginConfig != null) { |
+ throw new PluginConfigFormatException( |
+ 'Unrecognized plugin config format (expected `YamlMap`, got `${pluginConfig.runtimeType}`)', |
+ pluginConfig); |
} |
} |
} |
@@ -77,6 +76,16 @@ class PluginConfig { |
} |
} |
+/// Thrown on bad plugin config format. |
+class PluginConfigFormatException implements Exception { |
+ /// Descriptive message. |
+ final message; |
+ |
+ /// The `plugin:` yaml node for generating detailed error feedback. |
+ final yamlNode; |
+ PluginConfigFormatException(this.message, this.yamlNode); |
+} |
+ |
/// Extracts plugin config details from analysis options. |
class PluginConfigOptionsProcessor extends OptionsProcessor { |
final ErrorHandler _errorHandler; |