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

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: Created 7 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
Index: sdk/lib/async/future.dart
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index db26cee4adf311433b4754986f0dba4bfb92edb6..106b4f55bbb5e40e9aa706e88fbab0e5017c6bba 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";
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698