persistence
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -234,4 +234,9 @@ var logging = require('minilog')('persistence'), | ||
if (err) { | ||
logging.error({ error: err.toString() }); | ||
if (/READONLY/.test(err.toString())) { | ||
if (!(err instanceof Error)) { | ||
err = new Error(err); | ||
} | ||
logging.error(err); | ||
if (/READONLY/.test(String(err))) { | ||
throw new Error(err); | ||
@@ -238,0 +243,0 @@ } |
{ | ||
"name": "persistence", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "An abstraction library for redis and sentinel connection management", | ||
@@ -21,2 +21,3 @@ "main": "lib/index.js", | ||
"mocha": "*", | ||
"proxyquire": "^1.7.3", | ||
"simple_sentinel": "*" | ||
@@ -23,0 +24,0 @@ }, |
@@ -81,5 +81,8 @@ var assert = require('assert'), | ||
}); | ||
after(function() { | ||
after(function(done) { | ||
this.timeout(10000); | ||
SentinelHelper.stop(helper_config); | ||
setTimeout(function () { | ||
done() | ||
}, 200) | ||
}); | ||
@@ -86,0 +89,0 @@ |
@@ -1,5 +0,6 @@ | ||
var assert = require('assert'), | ||
SentinelHelper = require('simple_sentinel'), | ||
Persistence = require('../lib/persistence.js'), | ||
client; | ||
var assert = require('assert'); | ||
var SentinelHelper = require('simple_sentinel'); | ||
var Persistence = require('../lib/persistence.js'); | ||
var client; | ||
var proxyquire = require('proxyquire'); | ||
@@ -47,2 +48,18 @@ describe('given a connected persistence', function() { | ||
}); | ||
it('should log an Error object', function () { | ||
var logged | ||
var spy = function () { | ||
return { | ||
error: function (x) { | ||
logged = x | ||
} | ||
} | ||
} | ||
var Persistence = proxyquire('../lib/persistence', {'minilog': spy}) | ||
Persistence.handler('x'); | ||
assert(logged instanceof Error); | ||
Persistence.handler(new Error('x')); | ||
assert(logged instanceof Error); | ||
}) | ||
}); | ||
@@ -49,0 +66,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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
54365
1261
3
4