AmpersandJS / ampersand

Quickest way to get started with ampersand.
MIT License
812 stars 41 forks source link

ampersand gen does not throw a proper error when specifying an invalid type #123

Open coder13 opened 7 years ago

coder13 commented 7 years ago

This is the result of another error I found when I was trying to do ampersand gen collection and it was complaining

path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.relative (path.js:1229:5)
    at module.exports (/home/caleb/.nvm/versions/node/v6.7.0/lib/node_modules/ampersand/lib/generate-template.js:54:31)
    at Object.<anonymous> (/home/caleb/.nvm/versions/node/v6.7.0/lib/node_modules/ampersand/bin/ampersand:59:5)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)

https://github.com/AmpersandJS/ampersand/blob/116ea5c9a3051b101f70550bc2dad243b4249286/lib/generate-template.js#L29-L50 does not have an if case for collection even though the doc says that I can ampersand gen collection thus https://github.com/AmpersandJS/ampersand/blob/116ea5c9a3051b101f70550bc2dad243b4249286/lib/generate-template.js#L54 complains about filePath being undefined.