Comparing version 4.0.0 to 4.0.1
@@ -6,2 +6,3 @@ 'use strict'; | ||
const Boom = require('boom'); | ||
const Hoek = require('hoek'); | ||
const Items = require('items'); | ||
@@ -162,2 +163,6 @@ const RethinkDB = require('rethinkdb'); | ||
if (!this._db._connection) { | ||
return Hoek.nextTick(callback)(new Error('Database disconnected')); | ||
} | ||
this._table.sync().run(this._db._connection, (err, result) => { | ||
@@ -191,2 +196,6 @@ | ||
if (!this._db._connection) { | ||
return Hoek.nextTick(callback)(new Error('Database disconnected')); | ||
} | ||
let request = this._table; | ||
@@ -228,2 +237,6 @@ if (criteria !== '*') { | ||
if (!this._db._connection) { | ||
return Hoek.nextTick(callback)(new Error('Database disconnected')); | ||
} | ||
next = next || callback; // next() must never return an error | ||
@@ -230,0 +243,0 @@ |
{ | ||
"name": "penseur", | ||
"description": "Lightweight RethinkDB wrapper", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/hueniverse/penseur", |
@@ -6,2 +6,3 @@ 'use strict'; | ||
const Code = require('code'); | ||
const Hoek = require('hoek'); | ||
const Lab = require('lab'); | ||
@@ -133,2 +134,14 @@ const Penseur = require('..'); | ||
}); | ||
it('fails on disconnected database', (done) => { | ||
const db = new Penseur.Db('penseurtest'); | ||
db.table('test'); | ||
db.test.get('1', (err) => { | ||
expect(err).to.exist(); | ||
expect(err.message).to.equal('Database disconnected'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -896,2 +909,14 @@ | ||
it('fails on disconnected database', (done) => { | ||
const db = new Penseur.Db('penseurtest'); | ||
db.table('test'); | ||
db.test.changes('*', Hoek.ignore, (err) => { | ||
expect(err).to.exist(); | ||
expect(err.message).to.equal('Database disconnected'); | ||
done(); | ||
}); | ||
}); | ||
it('reports on a record update (*)', (done) => { | ||
@@ -1230,3 +1255,15 @@ | ||
}); | ||
it('fails on disconnected database', (done) => { | ||
const db = new Penseur.Db('penseurtest'); | ||
db.table('test'); | ||
db.test.sync((err) => { | ||
expect(err).to.exist(); | ||
expect(err.message).to.equal('Database disconnected'); | ||
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
86896
2085