OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "async.dart"; | 5 part of "dart:async"; |
6 | 6 |
7 _invokeErrorHandler( | 7 _invokeErrorHandler( |
8 Function errorHandler, Object error, StackTrace stackTrace) { | 8 Function errorHandler, Object error, StackTrace stackTrace) { |
9 if (errorHandler is ZoneBinaryCallback<dynamic, Null, Null>) { | 9 if (errorHandler is ZoneBinaryCallback<dynamic, Null, Null>) { |
10 return (errorHandler as dynamic)(error, stackTrace); | 10 return (errorHandler as dynamic)(error, stackTrace); |
11 } else { | 11 } else { |
12 ZoneUnaryCallback unaryErrorHandler = errorHandler; | 12 ZoneUnaryCallback unaryErrorHandler = errorHandler; |
13 return unaryErrorHandler(error); | 13 return unaryErrorHandler(error); |
14 } | 14 } |
15 } | 15 } |
16 | 16 |
17 Function _registerErrorHandler<R>(Function errorHandler, Zone zone) { | 17 Function _registerErrorHandler<R>(Function errorHandler, Zone zone) { |
18 if (errorHandler is ZoneBinaryCallback<dynamic, Null, Null>) { | 18 if (errorHandler is ZoneBinaryCallback<dynamic, Null, Null>) { |
19 return zone.registerBinaryCallback<R, Object, StackTrace>( | 19 return zone.registerBinaryCallback<R, Object, StackTrace>( |
20 errorHandler as dynamic/*=ZoneBinaryCallback<R, Object, StackTrace>*/); | 20 errorHandler as dynamic/*=ZoneBinaryCallback<R, Object, StackTrace>*/); |
21 } else { | 21 } else { |
22 return zone.registerUnaryCallback<R, Object>( | 22 return zone.registerUnaryCallback<R, Object>( |
23 errorHandler as dynamic/*=ZoneUnaryCallback<R, Object>*/); | 23 errorHandler as dynamic/*=ZoneUnaryCallback<R, Object>*/); |
24 } | 24 } |
25 } | 25 } |
OLD | NEW |