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 dart.async; | 5 part of "async.dart"; |
6 | 6 |
7 /** Runs user code and takes actions depending on success or failure. */ | 7 /** Runs user code and takes actions depending on success or failure. */ |
8 _runUserCode<T>( | 8 _runUserCode<T>( |
9 T userCode(), onSuccess(T value), onError(error, StackTrace stackTrace)) { | 9 T userCode(), onSuccess(T value), onError(error, StackTrace stackTrace)) { |
10 try { | 10 try { |
11 onSuccess(userCode()); | 11 onSuccess(userCode()); |
12 } catch (e, s) { | 12 } catch (e, s) { |
13 AsyncError replacement = Zone.current.errorCallback(e, s); | 13 AsyncError replacement = Zone.current.errorCallback(e, s); |
14 if (replacement == null) { | 14 if (replacement == null) { |
15 onError(e, s); | 15 onError(e, s); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 _addErrorWithReplacement(sink, e, s); | 490 _addErrorWithReplacement(sink, e, s); |
491 return; | 491 return; |
492 } | 492 } |
493 if (!isEqual) { | 493 if (!isEqual) { |
494 sink._add(inputEvent); | 494 sink._add(inputEvent); |
495 subscription._value = inputEvent; | 495 subscription._value = inputEvent; |
496 } | 496 } |
497 } | 497 } |
498 } | 498 } |
499 } | 499 } |
OLD | NEW |