Comparing version 1.2.1 to 1.2.2
@@ -25,9 +25,10 @@ var acomb = exports; | ||
var callback = _last(arguments), | ||
args = _initial(arguments); | ||
args = _initial(arguments), | ||
result; | ||
try { | ||
var result = func.apply(this, args); | ||
callback(null, result); | ||
result = func.apply(this, args); | ||
} catch (e) { | ||
callback(e); | ||
return callback(e); | ||
} | ||
callback(null, result); | ||
}; | ||
@@ -34,0 +35,0 @@ }; |
{ | ||
"name": "acomb", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Higher-order utilities for use with async functions", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
12
test.js
@@ -45,2 +45,14 @@ var a = require("./"); | ||
}); | ||
it("should not catch errors in the callback", function (done) { | ||
try { | ||
a.asyncify(function () {})(function (err) { | ||
if (err) { return done(new Error("should not get an error here")); } | ||
throw new Error("callback error"); | ||
}); | ||
} catch (e) { | ||
assert(e.message === "callback error"); | ||
done(); | ||
} | ||
}); | ||
}); | ||
@@ -47,0 +59,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17329
366