Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Side by Side Diff: corelib/src/implementation/future_implementation.dart

Issue 9006053: frog await: allow errors after the await within try-catch blocks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | frog/await/transformation.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 Google Inc. All Rights Reserved. 1 // Copyright 2011 Google Inc. All Rights Reserved.
2 // Dart core library. 2 // Dart core library.
3 3
4 /** 4 /**
5 * Thrown if client tries to obtain value or exception 5 * Thrown if client tries to obtain value or exception
6 * before a future has completed. 6 * before a future has completed.
7 */ 7 */
8 class FutureNotCompleteException implements Exception { 8 class FutureNotCompleteException implements Exception {
9 FutureNotCompleteException() {} 9 FutureNotCompleteException() {}
10 String toString() => "Exception: future has not been completed"; 10 String toString() => "Exception: future has not been completed";
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 void handleException(void onException(Object exception)) { 93 void handleException(void onException(Object exception)) {
94 _exceptionHandlers.add(onException); 94 _exceptionHandlers.add(onException);
95 } 95 }
96 96
97 void _complete() { 97 void _complete() {
98 _isComplete = true; 98 _isComplete = true;
99 if (_exception !== null) { 99 if (_exception !== null) {
100 for (Function handler in _exceptionHandlers) { 100 for (Function handler in _exceptionHandlers) {
101 if (handler(_exception)) { 101 if (handler(_exception)) {
102 _exceptionHandled = true; 102 _exceptionHandled = true;
103 break;
Siggi Cherem (dart-lang) 2011/12/28 20:11:59 Matt - Something I wanted to make sure here is thi
mattsh 2011/12/28 20:55:57 Yes. This is good.
103 } 104 }
104 } 105 }
105 } 106 }
106 if (hasValue) { 107 if (hasValue) {
107 for (Function listener in _listeners) { 108 for (Function listener in _listeners) {
108 listener(value); 109 listener(value);
109 } 110 }
110 } else { 111 } else {
111 if (!_exceptionHandled && _listeners.length > 0) { 112 if (!_exceptionHandled && _listeners.length > 0) {
112 throw _exception; 113 throw _exception;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 147 }
147 148
148 void complete(T value) { 149 void complete(T value) {
149 _futureImpl._setValue(value); 150 _futureImpl._setValue(value);
150 } 151 }
151 152
152 void completeException(var exception) { 153 void completeException(var exception) {
153 _futureImpl._setException(exception); 154 _futureImpl._setException(exception);
154 } 155 }
155 } 156 }
OLDNEW
« no previous file with comments | « no previous file | frog/await/transformation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698