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

Unified Diff: sdk/lib/_internal/pub/lib/src/utils.dart

Issue 315063002: Display timeout errors more gracefully. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 6 years, 6 months 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/lib/src/source/hosted.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/utils.dart
diff --git a/sdk/lib/_internal/pub/lib/src/utils.dart b/sdk/lib/_internal/pub/lib/src/utils.dart
index d9ab8a95294d54646db34daaf44d38ba1bcee9cc..7903d7faea91a7ec92bd10c7bc5c046ed5c2d06d 100644
--- a/sdk/lib/_internal/pub/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub/lib/src/utils.dart
@@ -620,6 +620,15 @@ String nicePath(String inputPath) {
return relative;
}
+/// Returns a human-friendly representation of [duration].
+String niceDuration(Duration duration) {
+ var result = duration.inMinutes > 0 ? "${duration.inMinutes}:" : "";
+
+ var s = duration.inSeconds % 59;
+ var ms = (duration.inMilliseconds % 1000) ~/ 100;
+ return result + "$s.${ms}s";
+}
+
/// Decodes a URL-encoded string. Unlike [Uri.decodeComponent], this includes
/// replacing `+` with ` `.
String urlDecode(String encoded) =>
@@ -844,7 +853,8 @@ final _userFacingExceptions = new Set<String>.from([
'IsolateSpawnException',
// TODO(nweiz): clean up the dart:io errors when issue 9955 is fixed.
'FileSystemException', 'HttpException', 'OSError',
- 'ProcessException', 'SocketException', 'WebSocketException'
+ 'ProcessException', 'SocketException', 'TimeoutException',
+ 'WebSocketException'
]);
/// Returns whether [error] is a user-facing error object. This includes both
@@ -865,6 +875,7 @@ bool isUserFacingException(error) {
error is http.ClientException ||
error is OSError ||
error is ProcessException ||
+ error is TimeoutException ||
error is SocketException ||
error is WebSocketException;
}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/source/hosted.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698