| Index: pkg/barback/lib/src/errors.dart
|
| diff --git a/pkg/barback/lib/src/errors.dart b/pkg/barback/lib/src/errors.dart
|
| index d62efeb1f8959a568d21ff6f511f385fef743eee..5303b9d5629fc041bd6cea0d6675912d47567f8b 100644
|
| --- a/pkg/barback/lib/src/errors.dart
|
| +++ b/pkg/barback/lib/src/errors.dart
|
| @@ -115,25 +115,26 @@ abstract class _WrappedException implements BarbackException {
|
| final error;
|
| final Chain stackTrace;
|
|
|
| - _WrappedException(this.error, StackTrace stackTrace)
|
| - : this.stackTrace = stackTrace == null ? null :
|
| - new Chain.forTrace(stackTrace);
|
| + _WrappedException(error, StackTrace stackTrace)
|
| + : this.error = error,
|
| + this.stackTrace = _getChain(error, stackTrace);
|
|
|
| String get _message;
|
|
|
| String toString() {
|
| var result = "$_message: $error";
|
| -
|
| - var stack = stackTrace;
|
| - if (stack == null && error is Error) stack = error.stackTrace;
|
| - if (stack != null) {
|
| - result = "$result\n${stackTrace.terse}";
|
| - }
|
| -
|
| + if (stackTrace != null) result = "$result\n${stackTrace.terse}";
|
| return result;
|
| }
|
| }
|
|
|
| +/// Returns the stack chain for [error] and [stackTrace].
|
| +Chain _getChain(error, StackTrace stackTrace) {
|
| + if (error is Error && stackTrace == null) stackTrace = error.stackTrace;
|
| + if (stackTrace != null) return new Chain.forTrace(stackTrace);
|
| + return null;
|
| +}
|
| +
|
| /// Error wrapping an exception thrown by a transform.
|
| class TransformerException extends _WrappedException {
|
| /// The transform that threw the exception.
|
|
|