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

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/dependency_computer.dart

Issue 1106803002: Properly print an error when failing to load a transformer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_from_a_deps_dev_dependency_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/barback/dependency_computer.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/dependency_computer.dart b/sdk/lib/_internal/pub/lib/src/barback/dependency_computer.dart
index dfca1273ba84209dfda7230ed9b941f619d8d8dd..9e46b46d06b15d1f3d0cff2ac6801abdb6af3dea 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/dependency_computer.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/dependency_computer.dart
@@ -11,6 +11,7 @@ import '../dart.dart';
import '../io.dart';
import '../package.dart';
import '../package_graph.dart';
+import '../pubspec.dart';
import '../utils.dart';
import 'cycle_exception.dart';
import 'transformer_config.dart';
@@ -104,6 +105,17 @@ class DependencyComputer {
/// loaded.
Set<TransformerId> _transformersNeededByTransformer(TransformerId id) {
if (id.isBuiltInTransformer) return new Set();
+
+ if (!_graph.packages.containsKey(id.package)) {
+ // Throw this here rather than during pubspec parsing because by the time
+ // we're here, we're sure that the package is actually transforming public
+ // assets and that being unable to load it will be a problem.
+ throw new PubspecException(
+ 'Error loading transformer "$id": package "${id.package}" is not '
+ 'a dependency.',
+ id.span);
+ }
+
_loadPackageComputer(id.package);
return _packageComputers[id.package]._transformersNeededByTransformer(id);
}
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_from_a_deps_dev_dependency_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698