Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(926)

Unified Diff: pkg/stack_trace/test/chain_test.dart

Issue 232123003: Properly handle errors thrown in [Chain.capture]'s [onError] handler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/stack_trace/lib/src/stack_zone_specification.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/stack_trace/test/chain_test.dart
diff --git a/pkg/stack_trace/test/chain_test.dart b/pkg/stack_trace/test/chain_test.dart
index d9915ebf1f9767c21b1c8890bd95471d73730b3f..683544f1d26ad885fbd961db53d2cadf35148cd0 100644
--- a/pkg/stack_trace/test/chain_test.dart
+++ b/pkg/stack_trace/test/chain_test.dart
@@ -107,6 +107,29 @@ void main() {
return completer.future;
});
+
+ test('and relays them to the parent zone', () {
+ var completer = new Completer();
+
+ runZoned(() {
+ Chain.capture(() {
+ inMicrotask(() => throw 'error');
+ }, onError: (error, chain) {
+ expect(error, equals('error'));
+ expect(chain.traces[1].frames,
+ contains(frameMember(startsWith('inMicrotask'))));
+ throw error;
+ });
+ }, onError: (error, chain) {
+ expect(error, equals('error'));
+ expect(chain, new isInstanceOf<Chain>());
+ expect(chain.traces[1].frames,
+ contains(frameMember(startsWith('inMicrotask'))));
+ completer.complete();
+ });
+
+ return completer.future;
+ });
});
test('capture() without onError passes exceptions to parent zone', () {
« no previous file with comments | « pkg/stack_trace/lib/src/stack_zone_specification.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698