Commit 14c1f1b9 14c1f1b98a33ea7b064669f74800e264d28f8def by Nicolas Perriault

bootstrap.js now throws CasperError in case package.json does not contain valid version information

1 parent 30c45923
......@@ -131,16 +131,16 @@ phantom.loadCasper = function() {
var fs = require('fs');
pkgFile = fs.absolute(fs.pathJoin(path, 'package.json'));
if (!fs.exists(pkgFile)) {
throw new Error('Cannot find package.json at ' + pkgFile);
throw new CasperError('Cannot find package.json at ' + pkgFile);
}
try {
pkg = JSON.parse(require('fs').read(pkgFile));
} catch (e) {
throw new Error('Cannot read package file contents: ' + e);
throw new CasperError('Cannot read package file contents: ' + e);
}
parts = pkg.version.trim().split(".");
if (parts < 3) {
throw new Error("Invalid version number");
throw new CasperError("Invalid version number");
}
patchPart = parts[2].split('-');
return {
......