OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:math' as math; | 6 import 'dart:math' as math; |
7 | 7 |
8 import 'frame.dart'; | 8 import 'frame.dart'; |
9 import 'lazy_chain.dart'; | 9 import 'lazy_chain.dart'; |
10 import 'stack_zone_specification.dart'; | 10 import 'stack_zone_specification.dart'; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 return runZoned(callback, onError: newOnError); | 87 return runZoned(callback, onError: newOnError); |
88 } | 88 } |
89 | 89 |
90 var spec = new StackZoneSpecification(onError); | 90 var spec = new StackZoneSpecification(onError); |
91 return runZoned(() { | 91 return runZoned(() { |
92 try { | 92 try { |
93 return callback(); | 93 return callback(); |
94 } catch (error, stackTrace) { | 94 } catch (error, stackTrace) { |
95 // TODO(nweiz): Don't special-case this when issue 19566 is fixed. | 95 // TODO(nweiz): Don't special-case this when issue 19566 is fixed. |
96 return Zone.current.handleUncaughtError(error, stackTrace); | 96 Zone.current.handleUncaughtError(error, stackTrace); |
| 97 return null; |
97 } | 98 } |
98 }, | 99 }, |
99 zoneSpecification: spec.toSpec(), | 100 zoneSpecification: spec.toSpec(), |
100 zoneValues: {_specKey: spec, StackZoneSpecification.disableKey: false}); | 101 zoneValues: {_specKey: spec, StackZoneSpecification.disableKey: false}); |
101 } | 102 } |
102 | 103 |
103 /// If [when] is `true` and this is called within a [Chain.capture] zone, runs | 104 /// If [when] is `true` and this is called within a [Chain.capture] zone, runs |
104 /// [callback] in a [Zone] in which chain capturing is disabled. | 105 /// [callback] in a [Zone] in which chain capturing is disabled. |
105 /// | 106 /// |
106 /// If [callback] returns a value, it will be returned by [disable] as well. | 107 /// If [callback] returns a value, it will be returned by [disable] as well. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 241 |
241 // Don't call out to [Trace.toString] here because that doesn't ensure that | 242 // Don't call out to [Trace.toString] here because that doesn't ensure that |
242 // padding is consistent across all traces. | 243 // padding is consistent across all traces. |
243 return traces.map((trace) { | 244 return traces.map((trace) { |
244 return trace.frames.map((frame) { | 245 return trace.frames.map((frame) { |
245 return '${frame.location.padRight(longest)} ${frame.member}\n'; | 246 return '${frame.location.padRight(longest)} ${frame.member}\n'; |
246 }).join(); | 247 }).join(); |
247 }).join(chainGap); | 248 }).join(chainGap); |
248 } | 249 } |
249 } | 250 } |
OLD | NEW |