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.build_result; | 5 library barback.build_result; |
6 | 6 |
7 import 'errors.dart'; | 7 import 'errors.dart'; |
8 import 'utils.dart'; | 8 import 'utils.dart'; |
9 | 9 |
10 /// An event indicating that the cascade has finished building all assets. | 10 /// An event indicating that the cascade has finished building all assets. |
(...skipping 26 matching lines...) Expand all Loading... |
37 factory BuildResult.aggregate(Iterable<BuildResult> results) { | 37 factory BuildResult.aggregate(Iterable<BuildResult> results) { |
38 var errors = unionAll(results.map((result) => result.errors)); | 38 var errors = unionAll(results.map((result) => result.errors)); |
39 return new BuildResult(errors); | 39 return new BuildResult(errors); |
40 } | 40 } |
41 | 41 |
42 String toString() { | 42 String toString() { |
43 if (succeeded) return "success"; | 43 if (succeeded) return "success"; |
44 | 44 |
45 return "errors:\n" + errors.map((error) { | 45 return "errors:\n" + errors.map((error) { |
46 var stackTrace = null; | 46 var stackTrace = null; |
47 if (error is TransformerException || error is AssetLoadException) { | 47 if (error is TransformerException) { |
| 48 stackTrace = error.stackTrace.terse; |
| 49 } else if (error is AssetLoadException) { |
48 stackTrace = error.stackTrace.terse; | 50 stackTrace = error.stackTrace.terse; |
49 } | 51 } |
50 | 52 |
51 var msg = new StringBuffer(); | 53 var msg = new StringBuffer(); |
52 msg.write(prefixLines(error.toString())); | 54 msg.write(prefixLines(error.toString())); |
53 if (stackTrace != null) { | 55 if (stackTrace != null) { |
54 msg.write("\n\n"); | 56 msg.write("\n\n"); |
55 msg.write("Stack chain:\n"); | 57 msg.write("Stack chain:\n"); |
56 msg.write(prefixLines(stackTrace.toString())); | 58 msg.write(prefixLines(stackTrace.toString())); |
57 } | 59 } |
58 return msg.toString(); | 60 return msg.toString(); |
59 }).join("\n\n"); | 61 }).join("\n\n"); |
60 } | 62 } |
61 } | 63 } |
OLD | NEW |