OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library barback.errors; | 5 library barback.errors; |
6 | 6 |
7 import 'package:stack_trace/stack_trace.dart'; | 7 import 'package:stack_trace/stack_trace.dart'; |
8 | 8 |
9 import 'asset/asset_id.dart'; | 9 import 'asset/asset_id.dart'; |
10 import 'transformer/wrapping_aggregate_transformer.dart'; | 10 import 'transformer/wrapping_aggregate_transformer.dart'; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 final Set<BarbackException> errors; | 53 final Set<BarbackException> errors; |
54 | 54 |
55 AggregateException(Iterable<BarbackException> errors) | 55 AggregateException(Iterable<BarbackException> errors) |
56 : errors = flattenAggregateExceptions(errors).toSet(); | 56 : errors = flattenAggregateExceptions(errors).toSet(); |
57 | 57 |
58 String toString() { | 58 String toString() { |
59 var buffer = new StringBuffer(); | 59 var buffer = new StringBuffer(); |
60 buffer.writeln("Multiple errors occurred:\n"); | 60 buffer.writeln("Multiple errors occurred:\n"); |
61 | 61 |
62 for (var error in errors) { | 62 for (var error in errors) { |
63 buffer.writeln(prefixLines(error.toString(), | 63 buffer.writeln( |
64 prefix: " ", firstPrefix: "- ")); | 64 prefixLines(error.toString(), prefix: " ", firstPrefix: "- ")); |
65 } | 65 } |
66 | 66 |
67 return buffer.toString(); | 67 return buffer.toString(); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 /// Error thrown when two or more transformers both output an asset with [id]. | 71 /// Error thrown when two or more transformers both output an asset with [id]. |
72 class AssetCollisionException implements BarbackException { | 72 class AssetCollisionException implements BarbackException { |
73 /// All the transforms that output an asset with [id]. | 73 /// All the transforms that output an asset with [id]. |
74 /// | 74 /// |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 /// The transformer that's run for this transform. | 171 /// The transformer that's run for this transform. |
172 /// | 172 /// |
173 /// This may be a [Transformer] or a [WrappingAggregateTransformer]. It may | 173 /// This may be a [Transformer] or a [WrappingAggregateTransformer]. It may |
174 /// also return additional types in the future. | 174 /// also return additional types in the future. |
175 final transformer; | 175 final transformer; |
176 | 176 |
177 /// The id of this transform's primary asset. | 177 /// The id of this transform's primary asset. |
178 final AssetId primaryId; | 178 final AssetId primaryId; |
179 | 179 |
180 TransformInfo(transformer, this.primaryId) | 180 TransformInfo(transformer, this.primaryId) |
181 : transformer = transformer is WrappingAggregateTransformer ? | 181 : transformer = transformer is WrappingAggregateTransformer |
182 transformer.transformer : transformer; | 182 ? transformer.transformer |
| 183 : transformer; |
183 | 184 |
184 bool operator==(other) => | 185 bool operator ==(other) => |
185 other is TransformInfo && | 186 other is TransformInfo && |
186 other.transformer == transformer && | 187 other.transformer == transformer && |
187 other.primaryId == primaryId; | 188 other.primaryId == primaryId; |
188 | 189 |
189 int get hashCode => transformer.hashCode ^ primaryId.hashCode; | 190 int get hashCode => transformer.hashCode ^ primaryId.hashCode; |
190 | 191 |
191 String toString() => "$transformer on $primaryId"; | 192 String toString() => "$transformer on $primaryId"; |
192 } | 193 } |
OLD | NEW |