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"; |
+ } |
} |
/** |