1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-02 12:27:08 +01:00

Improve errors / tests consistency.

This commit is contained in:
hacksalot
2016-01-14 14:22:26 -05:00
parent 86af2a2c4f
commit c9ae2ffef3
7 changed files with 127 additions and 10 deletions

View File

@ -67,7 +67,7 @@ Definition of the ResumeFactory class.
// Load and parse the resume JSON
var info = _parse( src, opts, emitter );
if( info.error ) return info;
if( info.fluenterror ) return info;
// Determine the resume format: FRESH or JRS
var json = info.json;
@ -123,6 +123,8 @@ Definition of the ResumeFactory class.
inner: e, raw: rawData, file: fileName, shouldExit: false
};
eve && eve.err( ex.fluenterror, ex );
if( opts.throw ) throw ex;
return ex;
}
}

View File

@ -40,13 +40,16 @@ Implementation of the 'analyze' verb for HackMyResume.
function analyze( sources, dst, opts ) {
this.stat('begin');
if( !sources || !sources.length ) throw { fluenterror: 3 };
var nlzrs = _loadInspectors();
_.each(sources, function(src) {
var result = ResumeFactory.loadOne( src, {
format: 'FRESH', objectify: true, throw: false
});
result.error || _analyze.call(this, result, nlzrs, opts );
format: 'FRESH', objectify: true
}, this);
result.fluenterror || _analyze.call(this, result, nlzrs, opts );
}, this);
this.stat('end');
}

View File

@ -67,7 +67,7 @@ Implementation of the 'build' verb for HackMyResume.
// Load the theme...we do this first because the theme choice (FRESH or
// JSON Resume) determines what format we'll convert the resume to.
this.stat( HME.beforeTheme, { theme: _opts.theme });
var tFolder = verifyTheme( _opts.theme );
var tFolder = verifyTheme.call( this, _opts.theme );
var theme = loadTheme( tFolder );
this.stat( HME.afterTheme, { theme: theme });

View File

@ -57,8 +57,8 @@ Implementation of the 'validate' verb for HackMyResume.
var ret = { file: src, isValid: false };
// If there was an error reading the resume
if( src.error ) {
if( opts.assert ) throw { fluenterror: HACKMYSTATUS.invalid };
if( src.fluenterror ) {
if( opts.assert ) throw src;
return ret;
}