1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-03 21:07:07 +01:00

Refactor command processing.

This commit is contained in:
hacksalot
2016-01-02 00:15:46 -05:00
parent 47553b6def
commit a95b52acd0
8 changed files with 74 additions and 60 deletions

View File

@ -92,7 +92,7 @@ Definition of the ResumeFactory class.
try {
// TODO: Core should not log
opts.log( chalk.gray('Reading resume: ') + chalk.cyan.bold(fileName) );
opts.log( chalk.cyan('Reading resume: ') + chalk.cyan.bold(fileName) );
// Read the file
rawData = FS.readFileSync( fileName, 'utf8' );
@ -106,7 +106,7 @@ Definition of the ResumeFactory class.
catch( ex ) {
// JSON.parse failed due to invalid JSON
if ( ex instanceof SyntaxError) {
if ( !opts.muffle && ex instanceof SyntaxError) {
var info = new SyntaxErrorEx( ex, rawData );
opts.log( chalk.red.bold(fileName.toUpperCase() + ' contains invalid JSON on line ' +
info.line + ' column ' + info.col + '.' +
@ -118,7 +118,8 @@ Definition of the ResumeFactory class.
if( opts.throw ) throw ex;
else return {
error: ex,
raw: rawData
raw: rawData,
file: fileName
};
}