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 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:stack_trace/stack_trace.dart'; | 9 import 'package:stack_trace/stack_trace.dart'; |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 /// [results]. | 40 /// [results]. |
41 factory BuildResult.aggregate(Iterable<BuildResult> results) { | 41 factory BuildResult.aggregate(Iterable<BuildResult> results) { |
42 var errors = unionAll(results.map((result) => result.errors)); | 42 var errors = unionAll(results.map((result) => result.errors)); |
43 return new BuildResult(errors); | 43 return new BuildResult(errors); |
44 } | 44 } |
45 | 45 |
46 String toString() { | 46 String toString() { |
47 if (succeeded) return "success"; | 47 if (succeeded) return "success"; |
48 | 48 |
49 return "errors:\n" + errors.map((error) { | 49 return "errors:\n" + errors.map((error) { |
50 var stackTrace = getAttachedStackTrace(error); | 50 var stackTrace = null; |
51 if (stackTrace != null) stackTrace = new Trace.from(stackTrace); | 51 if (error is TransformerException || error is AssetLoadException) { |
| 52 stackTrace = new Trace.from(error.stackTrace); |
| 53 } |
52 | 54 |
53 var msg = new StringBuffer(); | 55 var msg = new StringBuffer(); |
54 msg.write(prefixLines(error.toString())); | 56 msg.write(prefixLines(error.toString())); |
55 if (stackTrace != null) { | 57 if (stackTrace != null) { |
56 msg.write("\n\n"); | 58 msg.write("\n\n"); |
57 msg.write("Stack trace:\n"); | 59 msg.write("Stack trace:\n"); |
58 msg.write(prefixLines(stackTrace.toString())); | 60 msg.write(prefixLines(stackTrace.toString())); |
59 } | 61 } |
60 return msg.toString(); | 62 return msg.toString(); |
61 }).join("\n\n"); | 63 }).join("\n\n"); |
62 } | 64 } |
63 } | 65 } |
OLD | NEW |