Skip to content

Commit

Permalink
fix: catching config parsing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
saintsebastian committed Sep 19, 2017
1 parent 5552269 commit 295be34
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,6 @@ export class Program {
log.info('Version:', getVersion(absolutePackageDir));
}

if (argv.config) {
const configObject = loadJSConfigFile(argv.config);
try {
applyConfigToArgv({
argv,
configObject,
options: this.options,
configFileName: argv.config,
});
} catch (error) {
log.error(error.message);
}

}
try {
if (cmd === undefined) {
throw new UsageError('No sub-command was specified in the args');
Expand All @@ -160,6 +146,16 @@ export class Program {
});
}

if (argv.config) {
const configObject = loadJSConfigFile(argv.config);
await applyConfigToArgv({
argv,
configObject,
options: this.options,
configFileName: argv.config,
});
}

await runCommand(argv, {shouldExitProgram});

} catch (error) {
Expand Down

0 comments on commit 295be34

Please sign in to comment.