mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-05 09:56:22 +00:00
Move error handling out of core.
This commit is contained in:
parent
eddda8146e
commit
19b30d55ec
@ -10,7 +10,7 @@ Error-handling routines for HackMyResume.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
var HACKMYSTATUS = require('./status-codes')
|
var HACKMYSTATUS = require('../core/status-codes')
|
||||||
, PKG = require('../../package.json')
|
, PKG = require('../../package.json')
|
||||||
, FS = require('fs')
|
, FS = require('fs')
|
||||||
, FCMD = require('../hackmyapi')
|
, FCMD = require('../hackmyapi')
|
@ -194,7 +194,7 @@ Definition of the `main` function.
|
|||||||
function execute( src, dst, opts, log ) {
|
function execute( src, dst, opts, log ) {
|
||||||
|
|
||||||
loadOptions.call( this, opts, this.parent.jsonArgs );
|
loadOptions.call( this, opts, this.parent.jsonArgs );
|
||||||
require( '../core/error-handler' ).init( _opts.debug );
|
require( './error-handler' ).init( _opts.debug );
|
||||||
var out = new OUTPUT( _opts );
|
var out = new OUTPUT( _opts );
|
||||||
var v = new HMR.verbs[ this.name() ]();
|
var v = new HMR.verbs[ this.name() ]();
|
||||||
v.on( 'hmr:status', function() { out.do.apply( out, arguments ); });
|
v.on( 'hmr:status', function() { out.do.apply( out, arguments ); });
|
||||||
|
@ -12,41 +12,27 @@ Event code definitions.
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
unknown: 0,
|
error: -1,
|
||||||
unk: 0,
|
success: 0,
|
||||||
|
|
||||||
begin: 1,
|
begin: 1,
|
||||||
end: 2,
|
end: 2,
|
||||||
|
|
||||||
beforeRead: 3,
|
beforeRead: 3,
|
||||||
afterRead: 4,
|
afterRead: 4,
|
||||||
|
|
||||||
beforeCreate: 5,
|
beforeCreate: 5,
|
||||||
bc: 5,
|
|
||||||
|
|
||||||
afterCreate: 6,
|
afterCreate: 6,
|
||||||
ac: 6,
|
|
||||||
|
|
||||||
beforeTheme: 7,
|
beforeTheme: 7,
|
||||||
afterTheme: 8,
|
afterTheme: 8,
|
||||||
|
|
||||||
beforeMerge: 9,
|
beforeMerge: 9,
|
||||||
afterMerge: 10,
|
afterMerge: 10,
|
||||||
|
|
||||||
beforeGenerate: 11,
|
beforeGenerate: 11,
|
||||||
afterGenerate: 12,
|
afterGenerate: 12,
|
||||||
|
|
||||||
beforeAnalyze: 13,
|
beforeAnalyze: 13,
|
||||||
afterAnalyze: 14,
|
afterAnalyze: 14,
|
||||||
|
|
||||||
beforeConvert: 15,
|
beforeConvert: 15,
|
||||||
afterConvert: 16,
|
afterConvert: 16,
|
||||||
|
|
||||||
verifyOutputs: 17,
|
verifyOutputs: 17,
|
||||||
|
|
||||||
beforeParse: 18,
|
beforeParse: 18,
|
||||||
afterParse: 19
|
afterParse: 19
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,9 @@ Status codes for HackMyResume.
|
|||||||
invalidFormat: 12,
|
invalidFormat: 12,
|
||||||
notOnPath: 13,
|
notOnPath: 13,
|
||||||
readError: 14,
|
readError: 14,
|
||||||
parseError: 15
|
parseError: 15,
|
||||||
|
fileSaveError: 16,
|
||||||
|
generateError: 17
|
||||||
};
|
};
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
@ -141,6 +141,7 @@ Definition of the TemplateGenerator class. TODO: Refactor
|
|||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
// "Generate": process individual files within the theme
|
// "Generate": process individual files within the theme
|
||||||
|
// TODO: refactor
|
||||||
genInfo.files.forEach(function( file ){
|
genInfo.files.forEach(function( file ){
|
||||||
|
|
||||||
var thisFilePath;
|
var thisFilePath;
|
||||||
@ -169,8 +170,8 @@ Definition of the TemplateGenerator class. TODO: Refactor
|
|||||||
{ outputFile: fileName, mk: file.data, opts: that.opts } );
|
{ outputFile: fileName, mk: file.data, opts: that.opts } );
|
||||||
}
|
}
|
||||||
catch( ex ) {
|
catch( ex ) {
|
||||||
console.log(ex);
|
that.stat( HME.error, ex.fluenterrror ||
|
||||||
require('../core/error-handler').err(ex, false);
|
{ fluenterror: HACKMYSTATUS.fileSaveError, inner: ex } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( file.info.action === null/* && theme.explicit*/ ) {
|
else if( file.info.action === null/* && theme.explicit*/ ) {
|
||||||
@ -180,9 +181,8 @@ Definition of the TemplateGenerator class. TODO: Refactor
|
|||||||
FS.copySync( file.info.path, thisFilePath );
|
FS.copySync( file.info.path, thisFilePath );
|
||||||
}
|
}
|
||||||
catch( ex ) {
|
catch( ex ) {
|
||||||
console.log('B');
|
that.stat( HME.error, ex.fluenterrror ||
|
||||||
ex.showStack = true;
|
{ fluenterror: HACKMYSTATUS.fileSaveError, inner: ex } );
|
||||||
require('../core/error-handler').err( ex );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -281,8 +281,8 @@ Definition of the TemplateGenerator class. TODO: Refactor
|
|||||||
theme );
|
theme );
|
||||||
}
|
}
|
||||||
catch(ex) {
|
catch(ex) {
|
||||||
ex.showStack = true;
|
that.stat( HME.error, ex.fluenterrror ||
|
||||||
require('../core/error-handler').err( ex );
|
{ fluenterror: HACKMYSTATUS.generateError, inner: ex } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,6 @@ try {
|
|||||||
}
|
}
|
||||||
catch( ex ) {
|
catch( ex ) {
|
||||||
|
|
||||||
require('./core/error-handler').err( ex, true );
|
require('./cli/error-handler').err( ex, true );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ describe('Testing Ouput interface', function () {
|
|||||||
HMRMAIN( args );
|
HMRMAIN( args );
|
||||||
}
|
}
|
||||||
catch( ex ) {
|
catch( ex ) {
|
||||||
require('../src/core/error-handler').err( ex, false );
|
require('../src/cli/error-handler').err( ex, false );
|
||||||
}
|
}
|
||||||
CHALK.enabled = true;
|
CHALK.enabled = true;
|
||||||
process.exit = ProcessExitOrg;
|
process.exit = ProcessExitOrg;
|
||||||
|
Loading…
Reference in New Issue
Block a user