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

Unified Diff: sdk/lib/async/future.dart

Issue 94843002: Unify dart:async and pub/io.dart TimeoutException classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/pub/test/test_pub.dart ('k') | sdk/lib/async/future_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/future.dart
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index f4acd8c7fabba126a54816c422a52b9f24197158..f18cb1dd73423874eefbcfe98660ffef6c17fb39 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -429,12 +429,21 @@ abstract class Future<T> {
* Thrown when a scheduled timeout happens while waiting for an async result.
*/
class TimeoutException implements Exception {
- /** The duration that was exceeded without a result. */
+ /** Description of the cause of the timeout. */
+ final String message;
+ /** The duration that was exceeded. */
final Duration duration;
- TimeoutException(this.duration);
+ TimeoutException(this.message, [this.duration]);
- String toString() => "Timeout after $duration";
+ String toString() {
+ if (message != null) {
+ if (duration != null) return "TimeoutException after $duration: $message";
+ return "TimeoutException: $message";
+ }
+ if (duration != null) return "TimeoutException after $duration";
+ return "TimeoutException";
+ }
}
/**
« no previous file with comments | « sdk/lib/_internal/pub/test/test_pub.dart ('k') | sdk/lib/async/future_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698