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

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

Issue 196473016: Consider errors logged by a transformer equivalent to thrown errors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review 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..57d807497efdd29684fb8f964689c28abbce6981 100644
--- a/pkg/barback/lib/src/transform_node.dart
+++ b/pkg/barback/lib/src/transform_node.dart
@@ -229,7 +229,7 @@ class TransformNode {
}).catchError((error, stackTrace) {
// If the transform became dirty while processing, ignore any errors from
// it.
- if (!_state.isProcessing || _isRemoved) return;
+ if (!_state.isProcessing || _isRemoved) return false;
if (error is! MissingInputException) {
error = new TransformerException(info, error, stackTrace);
@@ -238,10 +238,8 @@ class TransformNode {
// 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);
-
- _clearOutputs();
- _dontEmitPassThrough();
- }).then((_) {
+ return true;
+ }).then((hadError) {
if (_isRemoved) return;
if (_state.needsIsPrimary) {
@@ -250,6 +248,11 @@ class TransformNode {
_apply();
} else {
assert(_state.isProcessing);
+ if (hadError) {
+ _clearOutputs();
+ _dontEmitPassThrough();
+ }
+
_state = _TransformNodeState.APPLIED;
_onDoneController.add(null);
}
@@ -277,14 +280,17 @@ class TransformNode {
/// Applies the transform so that it produces concrete (as opposed to lazy)
/// outputs.
- Future _applyImmediate() {
+ ///
+ /// Returns whether or not the transformer logged an error.
+ Future<bool> _applyImmediate() {
var transformController = new TransformController(this);
_onLogPool.add(transformController.onLog);
return syncFuture(() {
return transformer.apply(transformController.transform);
}).then((_) {
- if (!_state.isProcessing || _onAssetController.isClosed) return;
+ if (!_state.isProcessing || _onAssetController.isClosed) return false;
+ if (transformController.loggedError) return true;
_consumePrimary = transformController.consumePrimary;
@@ -325,19 +331,24 @@ class TransformNode {
_onAssetController.add(controller.node);
}
}
+
+ return false;
});
}
/// Applies the transform in declarative mode so that it produces lazy
/// outputs.
- Future _declareLazy() {
+ ///
+ /// Returns whether or not the transformer logged an error.
+ Future<bool> _declareLazy() {
var transformController = new DeclaringTransformController(this);
return syncFuture(() {
return (transformer as LazyTransformer)
.declareOutputs(transformController.transform);
}).then((_) {
- if (!_state.isProcessing || _onAssetController.isClosed) return;
+ if (!_state.isProcessing || _onAssetController.isClosed) return false;
+ if (transformController.loggedError) return true;
_consumePrimary = transformController.consumePrimary;
@@ -374,6 +385,8 @@ class TransformNode {
_onAssetController.add(controller.node);
}
}
+
+ return false;
});
}
« 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