Index: pkg/testing/lib/src/zone_helper.dart |
diff --git a/pkg/testing/lib/src/zone_helper.dart b/pkg/testing/lib/src/zone_helper.dart |
index 6f8364a5aef7e6c7ba4b517752f63ba79c70f7f5..0429260ed66549ac4a3afcdb1e2e2a6a6b120025 100644 |
--- a/pkg/testing/lib/src/zone_helper.dart |
+++ b/pkg/testing/lib/src/zone_helper.dart |
@@ -11,6 +11,10 @@ import 'dart:async' show |
ZoneSpecification, |
runZoned; |
+import 'dart:io' show |
+ exit, |
+ stderr; |
+ |
import 'dart:isolate' show |
Capability, |
Isolate, |
@@ -40,8 +44,16 @@ Future runGuarded( |
} else if (handleLateError != null) { |
handleLateError(error, stackTrace); |
} else { |
- // Delegate to parent. |
- throw error; |
+ String errorString = "error.toString() failed."; |
+ try { |
+ errorString = "$error"; |
+ } catch (_) { |
+ // Ignored. |
+ } |
+ stderr.write("$errorString\n" + |
+ (stackTrace == null ? "" : "$stackTrace")); |
+ stderr.flush(); |
+ exit(255); |
} |
} |
@@ -59,6 +71,7 @@ Future runGuarded( |
handleUncaughtError(error, stackTrace); |
}).asFuture(); |
+ Isolate.current.setErrorsFatal(false); |
Isolate.current.addErrorListener(errorPort.sendPort); |
return acknowledgeControlMessages(Isolate.current).then((_) { |
runZoned( |