Skip to content

Commit fb836bd

Browse files
authored
Merge pull request #67 from sjlu/develop
Missing `cb &&` on set
2 parents a2e938d + 8673c92 commit fb836bd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function redisStore(args) {
216216
}
217217

218218
if (!self.isCacheableValue(value)) {
219-
return cb(new Error('value cannot be ' + value));
219+
return cb && cb(new Error('value cannot be ' + value));
220220
}
221221

222222
options = options || {};

test/lib/redis-store-spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ describe('set', function () {
8686
});
8787

8888
it('should not be able to store a null value (not cacheable)', function (done) {
89-
try {
90-
redisCache.set('foo2', null);
89+
redisCache.set('foo2', null, function (err) {
90+
if (err) {
91+
return done();
92+
}
9193
done(new Error('Null is not a valid value!'));
92-
} catch (e) {
93-
done();
94-
}
94+
});
9595
});
9696

9797
it('should store a value without callback', function (done) {

0 commit comments

Comments
 (0)