Skip to content
This repository has been archived by the owner on Apr 26, 2022. It is now read-only.

Commit

Permalink
fixes for some error reporting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
amwmedia committed Nov 21, 2016
1 parent cf4dc80 commit fae2b4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/modules/generator-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ export default function (plop) {
// handle type
if (action.type === 'add') {
if (pathExists) {
throw failure(`File already exists: ${fileDestPath}`);
throw failure('File already exists');
} else {
yield fspp.makeDir(path.dirname(fileDestPath));
yield fspp.writeFile(fileDestPath, plop.renderString(template, data));
}
} else if (action.type === 'modify') {
if (!pathExists) {
throw failure(`File does not exists: ${fileDestPath}`);
throw failure('File does not exists');
} else {
var fileData = yield fspp.readFile(fileDestPath);
fileData = fileData.replace(action.pattern, plop.renderString(template, data));
Expand All @@ -139,7 +139,7 @@ export default function (plop) {
path: fileDestPath
};
} catch(err) {
throw failure(JSON.stringify(err));
throw failure(err.error || err.message || JSON.stringify(err));
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/modules/node-plop.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function nodePlop(plopfilePath = '', plopCfg = {}) {
}

// look for a package.json file to use for the "pkg" helper
try { pkgJson = require(`${getDestBasePath()}/package.json`); }
try { pkgJson = require(path.join(getDestBasePath(), 'package.json')); }
catch(error) { pkgJson = {}; }

/////////
Expand Down

0 comments on commit fae2b4e

Please sign in to comment.