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 (error is Error) stackTrace = error.stackTrace; | |
Bob Nystrom
2013/10/30 15:56:34
error will always be an instance of BarbackExcepti
floitsch
2013/10/30 18:39:40
Done.
| |
51 if (stackTrace != null) stackTrace = new Trace.from(stackTrace); | 52 if (stackTrace != null) stackTrace = new Trace.from(stackTrace); |
52 | 53 |
53 var msg = new StringBuffer(); | 54 var msg = new StringBuffer(); |
54 msg.write(prefixLines(error.toString())); | 55 msg.write(prefixLines(error.toString())); |
55 if (stackTrace != null) { | 56 if (stackTrace != null) { |
56 msg.write("\n\n"); | 57 msg.write("\n\n"); |
57 msg.write("Stack trace:\n"); | 58 msg.write("Stack trace:\n"); |
58 msg.write(prefixLines(stackTrace.toString())); | 59 msg.write(prefixLines(stackTrace.toString())); |
59 } | 60 } |
60 return msg.toString(); | 61 return msg.toString(); |
61 }).join("\n\n"); | 62 }).join("\n\n"); |
62 } | 63 } |
63 } | 64 } |
OLD | NEW |