Comparing version 0.1.3 to 0.1.4
@@ -5,3 +5,3 @@ /** | ||
var _ = require ('lodash'); | ||
module.exports.TRY = _.curry(function (desc, fn, fail, succ){ | ||
module.exports.TRY = function (desc, fn, fail, succ){ | ||
@@ -15,3 +15,3 @@ function getErrorObject(){ | ||
var index = caller_line.indexOf("at "); | ||
var clean = caller_line.slice(index+2, caller_line.length); | ||
var line = caller_line.slice(index+2, caller_line.length); | ||
@@ -21,6 +21,5 @@ fn(function(){ | ||
var error = _.first(argsArray); | ||
var stackTrace | ||
var args = _.rest(argsArray); | ||
if (error) { | ||
fail(error + "\n |"+ ((_.isString(desc) && !_.isEmpty(desc))?(" While " + desc):"") + " at:" + clean ); | ||
fail(error + "\n |"+ ((_.isString(desc) && !_.isEmpty(desc))?(" While " + desc):"") + " at:" + line ); | ||
} | ||
@@ -32,7 +31,15 @@ else if (_.isFunction(succ)) { | ||
} | ||
return function(printer){ | ||
printer(desc); | ||
}; | ||
}); | ||
}); | ||
return function(printer){ | ||
printer(desc); | ||
}; | ||
}; | ||
module.exports.TRY.to = function (desc, fn){ | ||
return function (callback){ | ||
module.exports.TRY(desc, fn, callback); | ||
}; | ||
}; |
{ | ||
"name": "async-try", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"main": "async-try.js", | ||
@@ -5,0 +5,0 @@ "repository": { |
3682
5
60