1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-03 21:07:07 +01:00
This commit is contained in:
hacksalot
2016-01-14 08:48:07 -05:00
parent 19b30d55ec
commit 7af50c51f6
9 changed files with 262 additions and 124 deletions

View File

@ -104,21 +104,25 @@ Definition of the ResumeFactory class.
var rawData;
try {
// Read the file
eve && eve.stat( HME.beforeRead, { file: fileName });
rawData = FS.readFileSync( fileName, 'utf8' );
eve && eve.stat( HME.afterRead, { data: rawData });
// Parse the file
eve && eve.stat( HME.beforeParse, { data: rawData });
var ret = {
json: JSON.parse( rawData )
};
var ret = { json: JSON.parse( rawData ) };
eve && eve.stat( HME.afterParse, { data: ret.json } );
return ret;
}
catch( ex ) {
throw {
catch( e ) {
// Can be ENOENT, EACCES, SyntaxError, etc.
var ex = {
fluenterror: rawData ? HACKMYSTATUS.parseError : HACKMYSTATUS.readError,
inner: ex, raw: rawData, file: fileName, shouldExit: false
inner: e, raw: rawData, file: fileName, shouldExit: false
};
eve && eve.err( ex.fluenterror, ex );
}
}