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 part of dart.async; | 5 part of dart.async; |
6 | 6 |
7 typedef dynamic ZoneCallback(); | 7 typedef dynamic ZoneCallback(); |
8 typedef dynamic ZoneUnaryCallback(arg); | 8 typedef dynamic ZoneUnaryCallback(arg); |
9 typedef dynamic ZoneBinaryCallback(arg1, arg2); | 9 typedef dynamic ZoneBinaryCallback(arg1, arg2); |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 ZoneSpecification specification, | 36 ZoneSpecification specification, |
37 Map zoneValues); | 37 Map zoneValues); |
38 | 38 |
39 /** Pair of error and stack trace. Returned by [Zone.errorCallback]. */ | 39 /** Pair of error and stack trace. Returned by [Zone.errorCallback]. */ |
40 class AsyncError implements Error { | 40 class AsyncError implements Error { |
41 final error; | 41 final error; |
42 final StackTrace stackTrace; | 42 final StackTrace stackTrace; |
43 | 43 |
44 AsyncError(this.error, this.stackTrace); | 44 AsyncError(this.error, this.stackTrace); |
45 | 45 |
46 String toString() => error.toString(); | 46 String toString() => '$error'; |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 class _ZoneFunction { | 50 class _ZoneFunction { |
51 final _Zone zone; | 51 final _Zone zone; |
52 final Function function; | 52 final Function function; |
53 const _ZoneFunction(this.zone, this.function); | 53 const _ZoneFunction(this.zone, this.function); |
54 } | 54 } |
55 | 55 |
56 /** | 56 /** |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 handleUncaughtError: errorHandler); | 1244 handleUncaughtError: errorHandler); |
1245 } | 1245 } |
1246 Zone zone = Zone.current.fork(specification: zoneSpecification, | 1246 Zone zone = Zone.current.fork(specification: zoneSpecification, |
1247 zoneValues: zoneValues); | 1247 zoneValues: zoneValues); |
1248 if (onError != null) { | 1248 if (onError != null) { |
1249 return zone.runGuarded(body); | 1249 return zone.runGuarded(body); |
1250 } else { | 1250 } else { |
1251 return zone.run(body); | 1251 return zone.run(body); |
1252 } | 1252 } |
1253 } | 1253 } |
OLD | NEW |