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

Side by Side Diff: sdk/lib/core/future_impl.dart

Issue 11308281: Preserve the stack trace for rethrown exceptions in Future.transformException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | tests/corelib/future_test.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 2012 Google Inc. All Rights Reserved. 1 // Copyright 2012 Google Inc. All Rights Reserved.
2 // Dart core library. 2 // Dart core library.
3 3
4 class _FutureImpl<T> implements Future<T> { 4 class _FutureImpl<T> implements Future<T> {
5 5
6 bool _isComplete = false; 6 bool _isComplete = false;
7 7
8 /** 8 /**
9 * Value that was provided to this Future by the Completer 9 * Value that was provided to this Future by the Completer
10 */ 10 */
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 final result = transformation(ex); 228 final result = transformation(ex);
229 229
230 // If the transformation itself returns a future, then we will 230 // If the transformation itself returns a future, then we will
231 // complete to what that completes to. 231 // complete to what that completes to.
232 if (result is Future) { 232 if (result is Future) {
233 _forward(result, completer); 233 _forward(result, completer);
234 } else { 234 } else {
235 completer.complete(result); 235 completer.complete(result);
236 } 236 }
237 } catch (innerException, stackTrace) { 237 } catch (innerException, stackTrace) {
238 completer.completeException(innerException, stackTrace); 238 if (identical(ex, innerException)) {
239 completer.completeException(innerException, this.stackTrace);
240 } else {
241 completer.completeException(innerException, stackTrace);
242 }
239 } 243 }
240 return false; 244 return false;
241 }); 245 });
242 246
243 _handleSuccess(completer.complete); 247 _handleSuccess(completer.complete);
244 248
245 return completer.future; 249 return completer.future;
246 } 250 }
247 251
248 /** 252 /**
(...skipping 27 matching lines...) Expand all
276 280
277 void complete(T value) { 281 void complete(T value) {
278 _futureImpl._setValue(value); 282 _futureImpl._setValue(value);
279 } 283 }
280 284
281 void completeException(Object exception, [Object stackTrace]) { 285 void completeException(Object exception, [Object stackTrace]) {
282 _futureImpl._setException(exception, stackTrace); 286 _futureImpl._setException(exception, stackTrace);
283 } 287 }
284 } 288 }
285 289
OLDNEW
« no previous file with comments | « no previous file | tests/corelib/future_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698