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

Unified Diff: pkg/barback/lib/src/transform_node.dart

Issue 199443003: Asset load failures in Barback should produce AssetNotFoundExceptions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/barback/lib/src/base_transform.dart ('k') | pkg/barback/test/package_graph/errors_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/lib/src/transform_node.dart
diff --git a/pkg/barback/lib/src/transform_node.dart b/pkg/barback/lib/src/transform_node.dart
index e3e122c7dbc9e17bf6be6cabab8190c19a90e2ca..51247be36d8822ce972871094916c037198ba623 100644
--- a/pkg/barback/lib/src/transform_node.dart
+++ b/pkg/barback/lib/src/transform_node.dart
@@ -186,13 +186,9 @@ class TransformNode {
// it.
if (_state.needsIsPrimary || _isRemoved) return false;
- if (error is! MissingInputException) {
- error = new TransformerException(info, error, stackTrace);
- }
-
// Catch all transformer errors and pipe them to the results stream. This
// is so a broken transformer doesn't take down the whole graph.
- phase.cascade.reportError(error);
+ phase.cascade.reportError(_wrapException(error, stackTrace));
return false;
}).then((isPrimary) {
@@ -231,13 +227,9 @@ class TransformNode {
// it.
if (!_state.isProcessing || _isRemoved) return;
- if (error is! MissingInputException) {
- error = new TransformerException(info, error, stackTrace);
- }
-
// Catch all transformer errors and pipe them to the results stream. This
// is so a broken transformer doesn't take down the whole graph.
- phase.cascade.reportError(error);
+ phase.cascade.reportError(_wrapException(error, stackTrace));
_clearOutputs();
_dontEmitPassThrough();
@@ -258,14 +250,13 @@ class TransformNode {
/// Gets the asset for an input [id].
///
- /// If an input with that ID cannot be found, throws an
- /// [AssetNotFoundException].
+ /// If an input with [id] cannot be found, throws an [AssetNotFoundException].
Future<Asset> getInput(AssetId id) {
return phase.getInput(id).then((node) {
// Throw if the input isn't found. This ensures the transformer's apply
// is exited. We'll then catch this and report it through the proper
// results stream.
- if (node == null) throw new MissingInputException(info, id);
+ if (node == null) throw new AssetNotFoundException(id);
_inputSubscriptions.putIfAbsent(node.id, () {
return node.onStateChange.listen((_) => _dirty(primaryChanged: false));
@@ -414,6 +405,14 @@ class TransformNode {
_passThroughController = null;
}
+ BarbackException _wrapException(error, StackTrace stackTrace) {
+ if (error is! AssetNotFoundException) {
+ return new TransformerException(info, error, stackTrace);
+ } else {
+ return new MissingInputException(info, error.id);
+ }
+ }
+
String toString() =>
"transform node in $_location for $transformer on $primary";
}
« no previous file with comments | « pkg/barback/lib/src/base_transform.dart ('k') | pkg/barback/test/package_graph/errors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698