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

Unified Diff: utils/pub/hosted_source.dart

Issue 14253005: Migrate pub away from throwing strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
Index: utils/pub/hosted_source.dart
diff --git a/utils/pub/hosted_source.dart b/utils/pub/hosted_source.dart
index 5a4106e29cac657b57ea2dafe8abcf349f93223c..a9e80cb0761cde4c79f4222c0210fcbf59405318 100644
--- a/utils/pub/hosted_source.dart
+++ b/utils/pub/hosted_source.dart
@@ -133,16 +133,19 @@ class HostedSource extends Source {
void _throwFriendlyError(error, package, url) {
if (error is PubHttpException &&
error.response.statusCode == 404) {
- throw 'Could not find package "$package" at $url.';
+ throw new UserFacingException('Could not find package "$package" at '
+ '$url.');
}
if (error is TimeoutException) {
- throw 'Timed out trying to find package "$package" at $url.';
+ throw new UserFacingException('Timed out trying to find package '
+ '"$package" at $url.');
}
if (error is io.SocketIOException) {
- throw 'Got socket error trying to find package "$package" at $url.\n'
- '${error.osError}';
+ throw new UserFacingException('Got socket error trying to find package '
+ '"$package" at $url.\n'
Bob Nystrom 2013/04/18 18:18:31 Nit, but I would probably move the whole string to
nweiz 2013/04/18 18:37:24 This was reformatted anyway due to [fail].
+ '${error.osError}');
}
// Otherwise re-throw the original exception.

Powered by Google App Engine
This is Rietveld 408576698