Fix Error management.

This commit is contained in:
2015-06-20 22:04:27 +05:30
parent f0fb70917a
commit 83cb1e0c46
2 changed files with 13 additions and 7 deletions
+10 -4
View File
@@ -53,12 +53,13 @@ Task.prototype.exec = function(_cb){
}; };
this.startTime = Date.now(); this.startTime = Date.now();
if( this.isAsync ){
return this.fn(cb);
}
try{ try{
if( this.isAsync ){
this.fn(cb);
} else {
this.fn(); this.fn();
cb(); cb();
}
} catch(e){ } catch(e){
cb(e); cb(e);
} }
@@ -76,7 +77,12 @@ Task.prototype.print = function(){
); );
if( this.err ){ if( this.err ){
console.log( this.err.stack ); if(this.err instanceof Error ){
// console.log( this.err.stack );
console.log( this.err );
}else{
console.log( this.err );
}
} }
}; };
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "simple-mocha", "name": "simple-mocha",
"version": "0.0.3", "version": "0.0.4",
"description": "Simple stupid implementation of Mocha test runner. Tests can be run directly within node as any Nodejs code.", "description": "Simple stupid implementation of Mocha test runner. Tests can be run directly within node as any Nodejs code.",
"author": "Harish.K<harish2704@gmail.com>", "author": "Harish.K<harish2704@gmail.com>",
"license": "MIT", "license": "MIT",