cimi/semver-sync — pull request #7 by lddubeau (2013-08-14 13:13:12+00:00)
Title: Report invalidly formed version numbers in files as an actual error to the end user rather than raise an exception.

As of 1.2.0 semver would exit like this upon encountering an invalid version number:

semver-sync -v

/home/ldd/local/lib/node_modules/semver-sync/index.js:36
rror('Missing or wrong semver number in ' + filename + '. Found: ' + version);
^
ReferenceError: version is not defined
at Object.module.exports.getVersion (/home/ldd/local/lib/node_modules/semver-sync/index.js:36:85)
[...]

The error message might be mistaken for an error that semver is issuing *on purpose* but that's actually the JavaScript interpreter reporting that the variable `version` in the `index.js` file is not defined at that location. In other words, semver is not raising the exception properly. Commit 497e713 actually fixes this specific problem.

However, it seems to me that if the user specified a version number which is not a valid semver pattern, the user should get an actual error message instead of the report of an unhanded exception. My other commits make this change. I've added a test case for it.