Index: pkg/barback/lib/src/errors.dart |
diff --git a/pkg/barback/lib/src/errors.dart b/pkg/barback/lib/src/errors.dart |
index a240bb41a43e447d70a9430bc0e0f7aac5d2cde1..bb9af79d416245af60a316ddb9e9fd92a47692ae 100644 |
--- a/pkg/barback/lib/src/errors.dart |
+++ b/pkg/barback/lib/src/errors.dart |
@@ -115,15 +115,17 @@ class InvalidOutputException implements BarbackException { |
abstract class _WrappedException implements BarbackException { |
/// The wrapped exception. |
final error; |
+ final StackTrace stackTrace; |
- _WrappedException(this.error); |
+ _WrappedException(this.error, this.stackTrace); |
String get _message; |
String toString() { |
var result = "$_message: $error"; |
- var stack = getAttachedStackTrace(error); |
+ var stack = stackTrace; |
+ if (stack == null && error is Error) stack = error.stackTrace; |
if (stack != null) { |
result = "$result\n${new Trace.from(stack).terse}"; |
} |
@@ -137,8 +139,8 @@ class TransformerException extends _WrappedException { |
/// The transform that threw the exception. |
final TransformInfo transform; |
- TransformerException(this.transform, error) |
- : super(error); |
+ TransformerException(this.transform, error, StackTrace stackTrace) |
+ : super(error, stackTrace); |
String get _message => "Transform $transform threw error"; |
} |
@@ -150,8 +152,8 @@ class TransformerException extends _WrappedException { |
class AssetLoadException extends _WrappedException { |
final AssetId id; |
- AssetLoadException(this.id, error) |
- : super(error); |
+ AssetLoadException(this.id, error, [StackTrace stackTrace]) |
+ : super(error, stackTrace); |
String get _message => "Failed to load source asset $id"; |
} |