cache-manager
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -0,1 +1,4 @@ | ||
- 1.2.2 2015-10-19 | ||
- Bugfix: Fixing domain error issues when error is thrown inside 'work' function (#28). | ||
- 1.2.1 2015-10-17 | ||
@@ -2,0 +5,0 @@ - Bugfix: multi-caching: using underlying store's isCacheableValue function when it exists (#34). |
@@ -166,3 +166,7 @@ /** @module cacheManager/multiCaching */ | ||
.on('error', function(err) { | ||
callbackFiller.fill(key, err); | ||
if (callbackFiller.has(key)) { | ||
callbackFiller.fill(key, err); | ||
} else { | ||
cb(err); | ||
} | ||
}) | ||
@@ -169,0 +173,0 @@ .bind(work)(function(err, data) { |
{ | ||
"name": "cache-manager", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Cache module for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -391,2 +391,3 @@ var assert = require('assert'); | ||
sinon.assert.calledWith(memoryCache3.store.set, key, {name: name}, {ttl: defaultTtl}); | ||
done(); | ||
@@ -870,2 +871,27 @@ }); | ||
context("when an error is thrown in the work function's callback", function() { | ||
var fakeError; | ||
beforeEach(function() { | ||
fakeError = new Error(support.random.string()); | ||
}); | ||
it("bubbles up that error", function(done) { | ||
multiCache.wrap(key, function(next) { | ||
next(); | ||
}, ttl, function() { | ||
// This test as-is doesn't prove a fix for #28 (https://github.com/BryanDonovan/node-cache-manager/issues/28) | ||
// but if you remove the try/catch, it shows that the undefined `waiting` array issue | ||
// is no longer present (the domain doesn't try to process the error in the callbackFiller). | ||
try { | ||
throw new Error('foo'); | ||
} catch (e) { | ||
assert.equal(e.message, 'foo'); | ||
} | ||
done(); | ||
}); | ||
}); | ||
}); | ||
context("when store.get() calls back with an error", function() { | ||
@@ -872,0 +898,0 @@ it("bubbles up that error", function(done) { |
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
118064
2500