From 83cb1e0c46e59a139836738fda2acef850494e71 Mon Sep 17 00:00:00 2001 From: "Harish.K" Date: Sat, 20 Jun 2015 22:04:27 +0530 Subject: [PATCH] Fix Error management. --- index.js | 18 ++++++++++++------ package.json | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 5c73a62..c1b14d3 100644 --- a/index.js +++ b/index.js @@ -53,12 +53,13 @@ Task.prototype.exec = function(_cb){ }; this.startTime = Date.now(); - if( this.isAsync ){ - return this.fn(cb); - } try{ - this.fn(); - cb(); + if( this.isAsync ){ + this.fn(cb); + } else { + this.fn(); + cb(); + } } catch(e){ cb(e); } @@ -76,7 +77,12 @@ Task.prototype.print = function(){ ); 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 ); + } } }; diff --git a/package.json b/package.json index 23c88ed..0cb9960 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "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.", "author": "Harish.K", "license": "MIT",