| OLD | NEW |
| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import "dart:convert"; | 6 import "dart:convert"; |
| 7 | 7 |
| 8 import 'package:pub_semver/pub_semver.dart'; | 8 import 'package:pub_semver/pub_semver.dart'; |
| 9 import 'package:stack_trace/stack_trace.dart'; | 9 import 'package:stack_trace/stack_trace.dart'; |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // See if we cached a failure. | 203 // See if we cached a failure. |
| 204 var error = _versionErrors[package]; | 204 var error = _versionErrors[package]; |
| 205 if (error != null) { | 205 if (error != null) { |
| 206 _versionCacheHits++; | 206 _versionCacheHits++; |
| 207 await new Future.error(error.first, error.last); | 207 await new Future.error(error.first, error.last); |
| 208 } | 208 } |
| 209 | 209 |
| 210 _versionCacheMisses++; | 210 _versionCacheMisses++; |
| 211 | 211 |
| 212 var source = _cache.source(package.source); | 212 var source = _cache.source(package.source); |
| 213 var ids; | 213 List<PackageId> ids; |
| 214 try { | 214 try { |
| 215 ids = await source.getVersions(package); | 215 ids = await source.getVersions(package); |
| 216 } catch (error, stackTrace) { | 216 } catch (error, stackTrace) { |
| 217 // If an error occurs, cache that too. We only want to do one request | 217 // If an error occurs, cache that too. We only want to do one request |
| 218 // for any given package, successful or not. | 218 // for any given package, successful or not. |
| 219 var chain = new Chain.forTrace(stackTrace); | 219 var chain = new Chain.forTrace(stackTrace); |
| 220 log.solver("Could not get versions for $package:\n$error\n\n" + | 220 log.solver("Could not get versions for $package:\n$error\n\n" + |
| 221 chain.terse.toString()); | 221 chain.terse.toString()); |
| 222 _versionErrors[package] = new Pair(error, chain); | 222 _versionErrors[package] = new Pair(error, chain); |
| 223 rethrow; | 223 rethrow; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 String _describeDependency(PackageDep dep) => | 337 String _describeDependency(PackageDep dep) => |
| 338 "depends on version ${dep.constraint}"; | 338 "depends on version ${dep.constraint}"; |
| 339 } | 339 } |
| 340 | 340 |
| 341 /// Exception thrown when the current SDK's version does not match a package's | 341 /// Exception thrown when the current SDK's version does not match a package's |
| 342 /// constraint on it. | 342 /// constraint on it. |
| 343 class BadSdkVersionException extends SolveFailure { | 343 class BadSdkVersionException extends SolveFailure { |
| 344 final String _message; | 344 final String _message; |
| 345 | 345 |
| 346 BadSdkVersionException(String package, String message) | 346 BadSdkVersionException(String package, String message) |
| 347 : super(package, null), | 347 : _message = message, |
| 348 _message = message; | 348 super(package, null); |
| 349 } | 349 } |
| 350 | 350 |
| 351 /// Exception thrown when the [VersionConstraint] used to match a package is | 351 /// Exception thrown when the [VersionConstraint] used to match a package is |
| 352 /// valid (i.e. non-empty), but there are no available versions of the package | 352 /// valid (i.e. non-empty), but there are no available versions of the package |
| 353 /// that fit that constraint. | 353 /// that fit that constraint. |
| 354 class NoVersionException extends SolveFailure { | 354 class NoVersionException extends SolveFailure { |
| 355 final VersionConstraint constraint; | 355 final VersionConstraint constraint; |
| 356 | 356 |
| 357 /// The last selected version of the package that failed to meet the new | 357 /// The last selected version of the package that failed to meet the new |
| 358 /// constraint. | 358 /// constraint. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 DependencyNotFoundException(String package, this._innerException, | 451 DependencyNotFoundException(String package, this._innerException, |
| 452 Iterable<Dependency> dependencies) | 452 Iterable<Dependency> dependencies) |
| 453 : super(package, dependencies); | 453 : super(package, dependencies); |
| 454 | 454 |
| 455 /// The failure isn't because of the version of description of the package, | 455 /// The failure isn't because of the version of description of the package, |
| 456 /// it's the package itself that can't be found, so just show the name and no | 456 /// it's the package itself that can't be found, so just show the name and no |
| 457 /// descriptive details. | 457 /// descriptive details. |
| 458 String _describeDependency(PackageDep dep) => ""; | 458 String _describeDependency(PackageDep dep) => ""; |
| 459 } | 459 } |
| OLD | NEW |