bootstrap.js now throws CasperError in case package.json does not contain valid version information
Showing
1 changed file
with
3 additions
and
3 deletions
... | @@ -131,16 +131,16 @@ phantom.loadCasper = function() { | ... | @@ -131,16 +131,16 @@ phantom.loadCasper = function() { |
131 | var fs = require('fs'); | 131 | var fs = require('fs'); |
132 | pkgFile = fs.absolute(fs.pathJoin(path, 'package.json')); | 132 | pkgFile = fs.absolute(fs.pathJoin(path, 'package.json')); |
133 | if (!fs.exists(pkgFile)) { | 133 | if (!fs.exists(pkgFile)) { |
134 | throw new Error('Cannot find package.json at ' + pkgFile); | 134 | throw new CasperError('Cannot find package.json at ' + pkgFile); |
135 | } | 135 | } |
136 | try { | 136 | try { |
137 | pkg = JSON.parse(require('fs').read(pkgFile)); | 137 | pkg = JSON.parse(require('fs').read(pkgFile)); |
138 | } catch (e) { | 138 | } catch (e) { |
139 | throw new Error('Cannot read package file contents: ' + e); | 139 | throw new CasperError('Cannot read package file contents: ' + e); |
140 | } | 140 | } |
141 | parts = pkg.version.trim().split("."); | 141 | parts = pkg.version.trim().split("."); |
142 | if (parts < 3) { | 142 | if (parts < 3) { |
143 | throw new Error("Invalid version number"); | 143 | throw new CasperError("Invalid version number"); |
144 | } | 144 | } |
145 | patchPart = parts[2].split('-'); | 145 | patchPart = parts[2].split('-'); |
146 | return { | 146 | return { | ... | ... |
-
Please register or sign in to post a comment