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

Improve behavior of PEEK command.

This commit is contained in:
hacksalot
2016-01-18 18:35:38 -05:00
parent e72564162b
commit d220cedfeb
5 changed files with 33 additions and 20 deletions

View File

@ -65,7 +65,7 @@ Error-handling routines for HackMyResume.
}
// Quit if necessary
if( objError.quit ) {
if( ex.quit || objError.quit ) {
this.debug && o(
chalk.cyan('Exiting with error code ' + ex.fluenterror.toString()));
if( this.assert ) { ex.pass = true; throw ex; }
@ -85,6 +85,7 @@ Error-handling routines for HackMyResume.
},
formatError: function( msg ) {
msg = msg || '';
return chalk.red.bold(
msg.toUpperCase().startsWith('ERROR:') ? msg : 'Error: ' + msg );
},
@ -102,7 +103,7 @@ Error-handling routines for HackMyResume.
function assembleError( ex ) {
var msg = '', withStack = false, isError = false, quit = true, warn = true;
var msg = '', withStack = false, isError = false, quit = false, warn = true;
if( this.debug ) withStack = true;
switch( ex.fluenterror ) {
@ -190,7 +191,7 @@ Error-handling routines for HackMyResume.
break;
case HMSTATUS.readError:
console.error( printf( M2C(this.msgs.readError.msg, 'red'), ex.file ) );
if( !ex.quiet ) console.error( printf( M2C(this.msgs.readError.msg, 'red'), ex.file ) );
msg = ex.inner.toString();
warn = false;
break;
@ -202,10 +203,15 @@ Error-handling routines for HackMyResume.
case HMSTATUS.parseError:
if( SyntaxErrorEx.is( ex.inner )) {
console.error( printf( M2C(this.msgs.readError.msg, 'red'), ex.file ) );
var se = new SyntaxErrorEx( ex, ex.raw );
msg = printf( M2C( this.msgs.parseError.msg, 'red' ),
se.line, se.col);
}
else if( ex.inner && ex.inner.line !== undefined && ex.inner.col !== undefined ) {
msg = printf( M2C( this.msgs.parseError.msg, 'red' ),
ex.inner.line, ex.inner.col);
}
else {
msg = ex;
}

View File

@ -198,9 +198,9 @@ Output routines for HackMyResume.
case HME.beforePeek:
if( evt.target )
L(M2C(this.msgs.beforePeek.msg[0], 'cyan'), evt.target, evt.file);
L(M2C(this.msgs.beforePeek.msg[0], evt.isError ? 'red' : 'green'), evt.target, evt.file);
else
L(M2C(this.msgs.beforePeek.msg[1], 'cyan'), evt.file);
L(M2C(this.msgs.beforePeek.msg[1], evt.isError ? 'red' : 'green'), evt.file);
break;
case HME.afterPeek: