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

Unified Diff: tests/corelib/future_test.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, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/core/future_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/future_test.dart
diff --git a/tests/corelib/future_test.dart b/tests/corelib/future_test.dart
index 1916dddfeddb9e0b68c331cf44b5835a13689713..f4e512c45d81339a310a6d11cfbaee48fd26a739 100644
--- a/tests/corelib/future_test.dart
+++ b/tests/corelib/future_test.dart
@@ -351,6 +351,19 @@ testCallStackIsCapturedIfChainCallbackThrows() {
Expect.isNotNull(chained.stackTrace);
}
+testCallStackIsPreservedIfExceptionIsRethrownInTransformException() {
+ final completer = new Completer();
+ var chained = completer.future.chain((_) {
+ throw 'whoops!';
+ });
+ var transformed = chained.transformException((e) {
+ throw e;
+ });
+
+ completer.complete('blah');
+ Expect.equals(transformed.stackTrace, chained.stackTrace);
+}
+
// Tests for mixed usage of [onComplete], [then], and [handleException]
testCompleteWithCompletionAndSuccessHandlers() {
@@ -677,6 +690,7 @@ main() {
testCallStackReturnsCallstackPassedToCompleteException();
testCallStackIsCapturedIfTransformCallbackThrows();
testCallStackIsCapturedIfChainCallbackThrows();
+ testCallStackIsPreservedIfExceptionIsRethrownInTransformException();
testCompleteWithCompletionAndSuccessHandlers();
testExceptionWithCompletionAndSuccessHandlers();
testExceptionWithCompletionAndSuccessAndExceptionHandlers();
« no previous file with comments | « sdk/lib/core/future_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698