OLD | NEW |
| (Empty) |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import "package:expect/expect.dart"; | |
6 import "package:async_helper/async_helper.dart"; | |
7 | |
8 void main() { | |
9 x() async { | |
10 print("Starting!"); | |
11 try { | |
12 await runAsync(); | |
13 } catch (e, st) { | |
14 print("Got exception and stacktrace:"); | |
15 var stText = st.toString(); | |
16 print(e); | |
17 print(stText); | |
18 // Stacktrace should be something like | |
19 // #0 runAsync.<runAsync_async_body> (this file) | |
20 // #1 Future.Future.microtask.<anonymous closure> (dart:async/future.
dart:184) | |
21 // #2 _microtaskLoop (dart:async/schedule_microtask.dart:41) | |
22 // #3 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50) | |
23 // #4 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.
dart:96) | |
24 // #5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_
patch.dart:149) | |
25 | |
26 // if exception and stacktrace is rethrown correctly, NOT | |
27 | |
28 // #0 main.<anonymous closure>.async_op (this file) | |
29 // #1 _asyncErrorWrapperHelper.<anonymous closure> (dart:async:134:33
) | |
30 // #2 _RootZone.runBinary (dart:async/zone.dart:1410:54) | |
31 // #3 _FutureListener.handleError (dart:async/future_impl.dart:146:20
) | |
32 // #4 _Future._propagateToListeners.handleError (dart:async/future_im
pl.dart:649:47) | |
33 // #5 _Future._propagateToListeners (dart:async/future_impl.dart:671:
13) | |
34 // #6 _Future._completeError (dart:async/future_impl.dart:485:5) | |
35 // #7 _SyncCompleter._completeError (dart:async/future_impl.dart:56:1
2) | |
36 // #8 _Completer.completeError (dart:async/future_impl.dart:27:5) | |
37 // #9 runAsync.async_op (this file) | |
38 // #10 Future.Future.microtask.<anonymous closure> (dart:async/future.
dart:184:26) | |
39 // #11 _microtaskLoop (dart:async/schedule_microtask.dart:41:5) | |
40 // #12 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5) | |
41 // #13 _runPendingImmediateCallback (dart:isolate:1054:5) | |
42 // #14 _RawReceivePortImpl._handleMessage (dart:isolate:1104:5) | |
43 | |
44 Expect.isFalse(stText.contains("propagateToListeners")); | |
45 Expect.isFalse(stText.contains("_completeError")); | |
46 } | |
47 print("Ending!"); | |
48 } | |
49 | |
50 asyncStart(); | |
51 x().then((_) => asyncEnd()); | |
52 } | |
53 | |
54 runAsync() async { | |
55 throw 'oh no!'; | |
56 } | |
OLD | NEW |