Chromium Code Reviews| Index: pkg/barback/lib/src/errors.dart |
| diff --git a/pkg/barback/lib/src/errors.dart b/pkg/barback/lib/src/errors.dart |
| index 138984ce58200de5d450f9a1b108efcb68f60b64..13886978505f46b51384d6f9853ea2a5600bdb23 100644 |
| --- a/pkg/barback/lib/src/errors.dart |
| +++ b/pkg/barback/lib/src/errors.dart |
| @@ -20,11 +20,32 @@ class AssetNotFoundException implements Exception { |
| String toString() => "Could not find asset $id."; |
| } |
| +/// Recursively removes any occurrences of [AggregateException] in [errors] |
|
nweiz
2013/08/20 19:59:26
"removes" -> "replaces"
Doing this recursively se
Bob Nystrom
2013/08/20 21:29:20
Done.
|
| +/// with the list of errors it contains. |
| +Iterable<BarbackException> flattenAggregateExceptions( |
| + Iterable<BarbackException> errors) { |
| + return errors.expand((error) { |
| + if (error is! AggregateException) return [error]; |
| + return flattenAggregateExceptions(error.errors); |
| + }); |
| +} |
| + |
| /// The interface for exceptions from the barback graph or its transformers. |
| /// |
| /// These exceptions are never produced by programming errors in barback. |
| abstract class BarbackException implements Exception {} |
| +/// An error that wraps a collection of other [BarbackException]s. |
| +/// |
| +/// It implicitly flattens any [AggregateException]s that occur in the list |
|
nweiz
2013/08/20 19:59:26
"list exceptions" -> "list of exceptions"
Bob Nystrom
2013/08/20 21:29:20
Done.
|
| +/// exceptions it wraps. |
| +class AggregateException implements BarbackException { |
| + final List<BarbackException> errors; |
|
nweiz
2013/08/20 19:59:26
It seems like this should be a set, since the orde
Bob Nystrom
2013/08/20 21:29:20
Done.
|
| + |
| + AggregateException(Iterable<BarbackException> errors) |
| + : errors = flattenAggregateExceptions(errors).toList(); |
| +} |
|
nweiz
2013/08/20 19:59:26
It would be nice to have a static method here that
Bob Nystrom
2013/08/20 21:29:20
Done.
|
| + |
| /// Error thrown when two or more transformers both output an asset with [id]. |
| class AssetCollisionException implements BarbackException { |
| /// All the transforms that output an asset with [id]. |