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

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

Issue 14253005: Migrate pub away from throwing strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/command_lish.dart ('k') | utils/pub/hosted_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 entrypoint; 5 library entrypoint;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:pathos/path.dart' as path; 9 import 'package:pathos/path.dart' as path;
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 log.fine("Deleting package directory for ${id.name} before install."); 80 log.fine("Deleting package directory for ${id.name} before install.");
81 deleteEntry(packageDir); 81 deleteEntry(packageDir);
82 } 82 }
83 83
84 if (id.source.shouldCache) { 84 if (id.source.shouldCache) {
85 return cache.install(id).then( 85 return cache.install(id).then(
86 (pkg) => createPackageSymlink(id.name, pkg.dir, packageDir)); 86 (pkg) => createPackageSymlink(id.name, pkg.dir, packageDir));
87 } else { 87 } else {
88 return id.source.install(id, packageDir).then((found) { 88 return id.source.install(id, packageDir).then((found) {
89 if (found) return null; 89 if (found) return null;
90 // TODO(nweiz): More robust error-handling. 90 fail('Package ${id.name} not found in source "${id.source.name}".');
91 throw 'Package ${id.name} not found in source "${id.source.name}".';
92 }); 91 });
93 } 92 }
94 }).then((_) => id.resolved); 93 }).then((_) => id.resolved);
95 94
96 _installs[id] = future; 95 _installs[id] = future;
97 96
98 return future; 97 return future;
99 } 98 }
100 99
101 /// Installs all dependencies of the [root] package to its "packages" 100 /// Installs all dependencies of the [root] package to its "packages"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 275 }
277 276
278 /// Creates a symlink to the `packages` directory in [dir]. Will replace one 277 /// Creates a symlink to the `packages` directory in [dir]. Will replace one
279 /// if already there. 278 /// if already there.
280 void _linkSecondaryPackageDir(String dir) { 279 void _linkSecondaryPackageDir(String dir) {
281 var symlink = path.join(dir, 'packages'); 280 var symlink = path.join(dir, 'packages');
282 if (entryExists(symlink)) deleteEntry(symlink); 281 if (entryExists(symlink)) deleteEntry(symlink);
283 createSymlink(packagesDir, symlink, relative: true); 282 createSymlink(packagesDir, symlink, relative: true);
284 } 283 }
285 } 284 }
OLDNEW
« no previous file with comments | « utils/pub/command_lish.dart ('k') | utils/pub/hosted_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698