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

Side by Side Diff: utils/pub/package.dart

Issue 11369066: Show better error messages in network failures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up string interpolation a bit. Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/io.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library package; 5 library package;
6 6
7 import 'io.dart'; 7 import 'io.dart';
8 import 'pubspec.dart'; 8 import 'pubspec.dart';
9 import 'source.dart'; 9 import 'source.dart';
10 import 'source_registry.dart'; 10 import 'source_registry.dart';
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 bool operator ==(other) { 130 bool operator ==(other) {
131 if (other is! PackageId) return false; 131 if (other is! PackageId) return false;
132 // TODO(rnystrom): We're assuming here the name/version/source tuple is 132 // TODO(rnystrom): We're assuming here the name/version/source tuple is
133 // enough to uniquely identify the package and that we don't need to delve 133 // enough to uniquely identify the package and that we don't need to delve
134 // into the description. 134 // into the description.
135 return other.name == name && 135 return other.name == name &&
136 other.source.name == source.name && 136 other.source.name == source.name &&
137 other.version == version; 137 other.version == version;
138 } 138 }
139 139
140 String toString() => "$name $version from ${source.name}"; 140 String toString() {
141 if (source.isDefault) return "$name $version";
142 return "$name $version from $source";
143 }
141 144
142 int compareTo(Comparable other) { 145 int compareTo(Comparable other) {
143 if (other is! PackageId) throw new ArgumentError(other); 146 if (other is! PackageId) throw new ArgumentError(other);
144 147
145 var sourceComp = source.name.compareTo(other.source.name); 148 var sourceComp = source.name.compareTo(other.source.name);
146 if (sourceComp != 0) return sourceComp; 149 if (sourceComp != 0) return sourceComp;
147 150
148 var nameComp = name.compareTo(other.name); 151 var nameComp = name.compareTo(other.name);
149 if (nameComp != 0) return nameComp; 152 if (nameComp != 0) return nameComp;
150 153
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 221
219 class PubspecNameMismatchException implements Exception { 222 class PubspecNameMismatchException implements Exception {
220 final String expectedName; 223 final String expectedName;
221 final String actualName; 224 final String actualName;
222 225
223 PubspecNameMismatchException(this.expectedName, this.actualName); 226 PubspecNameMismatchException(this.expectedName, this.actualName);
224 227
225 String toString() => 'The name you specified for your dependency, ' 228 String toString() => 'The name you specified for your dependency, '
226 '"$expectedName", doesn\'t match the name "$actualName" in its pubspec.'; 229 '"$expectedName", doesn\'t match the name "$actualName" in its pubspec.';
227 } 230 }
OLDNEW
« no previous file with comments | « utils/pub/io.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698