Index: pkg/unittest/lib/src/future_matchers.dart |
diff --git a/pkg/unittest/lib/src/future_matchers.dart b/pkg/unittest/lib/src/future_matchers.dart |
index cfc0518033f8dc8cd2e278b2803e7341efa1aacd..6067451a9bf590532a06a6082a14424d7724b7f2 100644 |
--- a/pkg/unittest/lib/src/future_matchers.dart |
+++ b/pkg/unittest/lib/src/future_matchers.dart |
@@ -42,12 +42,13 @@ class _Completes extends BaseMatcher { |
item.then((value) { |
done(() { if (_matcher != null) expect(value, _matcher); }); |
- }, onError: (e) { |
+ }, onError: (error) { |
var id = _id == '' ? '' : '${_id} '; |
var reason = 'Expected future ${id}to complete successfully, ' |
- 'but it failed with ${e.error}'; |
- if (e.stackTrace != null) { |
- var stackTrace = e.stackTrace.toString(); |
+ 'but it failed with ${error}'; |
+ var trace = getAttachedStackTrace(error); |
+ if (trace != null) { |
+ var stackTrace = trace.toString(); |
stackTrace = ' ${stackTrace.replaceAll('\n', '\n ')}'; |
reason = '$reason\nStack trace:\n$stackTrace'; |
} |