OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class SubclassOfError extends Error {} | 5 class SubclassOfError extends Error {} |
6 | 6 |
7 fail() => throw "Fail"; | 7 fail() => throw "Fail"; |
8 | 8 |
9 // == Rethrow, skipping through typed handlers. == | 9 // == Rethrow, skipping through typed handlers. == |
10 | 10 |
11 aa1() { | 11 aa1() { |
12 try { | 12 try { |
13 bb1(); | 13 bb1(); |
14 fail(); | 14 fail(); |
15 } catch(error | 15 } catch(error |
16 , stacktrace /// withtraceparameter: ok | 16 , stacktrace // /// withtraceparameter: ok |
17 ) { | 17 ) { |
18 expectTrace(['gg1', 'ff1', 'ee1', 'dd1', 'cc1', 'bb1', 'aa1'], error.stackTr
ace); | 18 expectTrace(['gg1', 'ff1', 'ee1', 'dd1', 'cc1', 'bb1', 'aa1'], error.stackTr
ace); |
19 expectTrace(['gg1', 'ff1', 'ee1', 'dd1', 'cc1', 'bb1', 'aa1'], stacktrace);
/// withtraceparameter: continued | 19 expectTrace(['gg1', 'ff1', 'ee1', 'dd1', 'cc1', 'bb1', 'aa1'], stacktrace);
// /// withtraceparameter: continued |
20 } | 20 } |
21 } | 21 } |
22 | 22 |
23 bb1() => cc1(); | 23 bb1() => cc1(); |
24 | 24 |
25 cc1() { | 25 cc1() { |
26 try { | 26 try { |
27 dd1(); | 27 dd1(); |
28 } on String catch(e) { | 28 } on String catch(e) { |
29 fail(); | 29 fail(); |
(...skipping 16 matching lines...) Expand all Loading... |
46 | 46 |
47 gg1() => throw new SubclassOfError(); | 47 gg1() => throw new SubclassOfError(); |
48 | 48 |
49 // == Rethrow, rethrow again in typed handler. == | 49 // == Rethrow, rethrow again in typed handler. == |
50 | 50 |
51 aa2() { | 51 aa2() { |
52 try { | 52 try { |
53 bb2(); | 53 bb2(); |
54 fail(); | 54 fail(); |
55 } catch(error | 55 } catch(error |
56 , stacktrace /// withtraceparameter: continued | 56 , stacktrace // /// withtraceparameter: continued |
57 ) { | 57 ) { |
58 expectTrace(['gg2', 'ff2', 'ee2', 'dd2', 'cc2', 'bb2', 'aa2'], error.stackTr
ace); | 58 expectTrace(['gg2', 'ff2', 'ee2', 'dd2', 'cc2', 'bb2', 'aa2'], error.stackTr
ace); |
59 expectTrace(['gg2', 'ff2', 'ee2', 'dd2', 'cc2', 'bb2', 'aa2'], stacktrace);
/// withtraceparameter: continued | 59 expectTrace(['gg2', 'ff2', 'ee2', 'dd2', 'cc2', 'bb2', 'aa2'], stacktrace);
// /// withtraceparameter: continued |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 bb2() => cc2(); | 63 bb2() => cc2(); |
64 | 64 |
65 cc2() { | 65 cc2() { |
66 try { | 66 try { |
67 dd2(); | 67 dd2(); |
68 } on SubclassOfError catch(e) { | 68 } on SubclassOfError catch(e) { |
69 rethrow; | 69 rethrow; |
(...skipping 16 matching lines...) Expand all Loading... |
86 | 86 |
87 gg2() => throw new SubclassOfError(); | 87 gg2() => throw new SubclassOfError(); |
88 | 88 |
89 // == Rethrow, with intervening catch without a trace parameter. | 89 // == Rethrow, with intervening catch without a trace parameter. |
90 | 90 |
91 aa3() { | 91 aa3() { |
92 try { | 92 try { |
93 bb3(); | 93 bb3(); |
94 fail(); | 94 fail(); |
95 } catch(error | 95 } catch(error |
96 , stacktrace /// withtraceparameter: continued | 96 , stacktrace // /// withtraceparameter: continued |
97 ) { | 97 ) { |
98 expectTrace(['gg3', 'ff3', 'ee3', 'dd3', 'cc3', 'bb3', 'aa3'], error.stackTr
ace); | 98 expectTrace(['gg3', 'ff3', 'ee3', 'dd3', 'cc3', 'bb3', 'aa3'], error.stackTr
ace); |
99 expectTrace(['cc3', 'bb3', 'aa3'], stacktrace); /// withtraceparameter: con
tinued | 99 expectTrace(['cc3', 'bb3', 'aa3'], stacktrace); // /// withtraceparameter: c
ontinued |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 bb3() => cc3(); | 103 bb3() => cc3(); |
104 | 104 |
105 cc3() { | 105 cc3() { |
106 try { | 106 try { |
107 dd3(); | 107 dd3(); |
108 } catch(e) { | 108 } catch(e) { |
109 throw e; | 109 throw e; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 expectedIndex++; | 146 expectedIndex++; |
147 } | 147 } |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 main() { | 151 main() { |
152 aa1(); | 152 aa1(); |
153 aa2(); | 153 aa2(); |
154 aa3(); | 154 aa3(); |
155 } | 155 } |
OLD | NEW |