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

Improve error handling.

This commit is contained in:
hacksalot
2016-01-18 14:10:35 -05:00
parent c8d8e566f8
commit 3e3803ed85
9 changed files with 134 additions and 39 deletions

View File

@ -155,6 +155,10 @@ Error-handling routines for HackMyResume.
warn = false;
break;
case HMSTATUS.generateError:
console.log(ex);
break;
case HMSTATUS.invalidFormat:
ex.data.forEach(function(d){
msg += printf( M2C( this.msgs.invalidFormat.msg, 'bold' ),
@ -162,6 +166,12 @@ Error-handling routines for HackMyResume.
}, this);
break;
case HMSTATUS.invalidHelperUse:
msg = printf( M2C( this.msgs.invalidHelperUse.msg ), ex.helper );
quit = false;
warn = true;
break;
case HMSTATUS.notOnPath:
msg = printf( M2C(this.msgs.notOnPath.msg, 'bold'), ex.engine);
quit = false;

View File

@ -26,7 +26,7 @@ events:
http-server <resume-folder>
For more information, see the README."
beforeGenerate:
afterGenerate:
msg:
- " (with %s)"
- "Skipping %s resume: %s"
@ -80,3 +80,5 @@ errors:
msg: Reading **???** resume: **%s**
parseError:
msg: Invalid or corrupt JSON on line %s column %s.
invalidHelperUse:
msg: Invalid use of the **%s** theme helper.

View File

@ -127,22 +127,22 @@ Output routines for HackMyResume.
}
break;
case HME.beforeGenerate:
case HME.afterGenerate:
var suffix = '';
if( evt.fmt === 'pdf' ) {
if( this.opts.pdf ) {
if( this.opts.pdf !== 'none' ) {
suffix = printf( M2C( this.msgs.beforeGenerate.msg[0], 'green' ), this.opts.pdf );
suffix = printf( M2C( this.msgs.afterGenerate.msg[0], evt.error ? 'red' : 'green' ), this.opts.pdf );
}
else {
L( M2C( this.msgs.beforeGenerate.msg[1], 'gray' ),
L( M2C( this.msgs.afterGenerate.msg[1], 'gray' ),
evt.fmt.toUpperCase(), evt.file );
return;
}
}
}
L( M2C( this.msgs.beforeGenerate.msg[2] + suffix, 'green' ),
L( M2C( this.msgs.afterGenerate.msg[2] + suffix, evt.error ? 'red' : 'green' ),
pad(evt.fmt.toUpperCase(),4,null,pad.RIGHT),
PATH.relative(process.cwd(), evt.file ));
break;