Change error messages a little

This commit is contained in:
David Greenspan
2015-03-10 01:40:25 -07:00
parent e7702f284e
commit 454af5d507
3 changed files with 12 additions and 6 deletions

View File

@@ -185,7 +185,7 @@ Tinytest.add("constraint solver - no results", function (test) {
]);
testWithResolver(test, resolver, function (t, FAIL) {
FAIL({foo: "w1.0.0", bar: "1.0.0"},
/No version of foo satisfies top-level constraints: @1.0.0/);
/No version of foo satisfies all constraints: @1.0.0/);
});
});

View File

@@ -338,7 +338,7 @@ Tinytest.add("constraint solver - input - conflicting top-level constraints", fu
"bar 1.0.0": ["foo"]
}
}
}, /No version of foo satisfies top-level constraints: @1.0.0, @2.0.0/);
}, /No version of foo satisfies all constraints: @1.0.0, @2.0.0/);
});
Tinytest.add("constraint solver - input - previous indirect deps", function (test) {
@@ -497,7 +497,7 @@ Tinytest.add("constraint solver - input - stack overflow bug", function (test) {
// It's not actually a good test of logic-solver overflowing the stack anymore,
// because the constraint-solver is smarter now.
doFailTest(test, STACK_OVERFLOW_BUG_INPUT,
/No version of follower-livedata satisfies top-level constraints: @0.9.0/);
/No version of follower-livedata satisfies all constraints: @0.9.0/);
});

View File

@@ -52,7 +52,9 @@ CS.Solver.prototype.calculateAllowedVersions = function () {
});
});
if (! versions.length) {
self.packagesWithNoAllowedVersions[p] = cs;
self.packagesWithNoAllowedVersions[p] = _.filter(cs, function (c) {
return !! c.constraintString;
});
}
allowedVersions[p] = versions;
});
@@ -504,7 +506,7 @@ CS.Solver.prototype.getSolution = function (options) {
logic.forbid(p);
} else {
self.errors.push(
'No version of ' + p + ' satisfies top-level constraints: ' +
'No version of ' + p + ' satisfies all constraints: ' +
_.map(constrs, function (constr) {
return '@' + constr.constraintString;
}).join(', '));
@@ -729,7 +731,11 @@ CS.Solver.prototype.analyzeRootDependencies = function () {
CS.Solver.prototype.throwAnyErrors = function () {
if (this.errors.length) {
CS.throwConstraintSolverError(this.errors.join('\n\n'));
var multiline = _.any(this.errors, function (e) {
return /\n/.test(e);
});
CS.throwConstraintSolverError(this.errors.join(
multiline ? '\n\n' : '\n'));
}
};