Permalink
Browse files

emit error on session_expiration

  • Loading branch information...
1 parent 9f48deb commit a36e0770175a1d30d5bec9caeee4a79c82631841 Yunong Xiao committed Nov 14, 2012
Showing with 5 additions and 4 deletions.
  1. +3 −2 lib/client.js
  2. +2 −2 test/client.test.js
View
5 lib/client.js
@@ -108,8 +108,8 @@ function ZKClient(options) {
self.close();
});
this.zk.once('close', this.onClose.bind(this));
- this.zk.on('connection_interrupted', function () {
- self.emit('connection_interrupted');
+ this.zk.on('not_connected', function () {
+ self.emit('not_connected');
});
this.zk.on('connect', function () {
self.emit('connect');
@@ -134,6 +134,7 @@ ZKClient.prototype.onError = function onError(zh, _path, code) {
case ZK.ZUNIMPLEMENTED:
case ZK.ZBADARGUMENTS:
case ZK.ZINVALIDSTATE:
+ case ZK.ZSESSIONEXPIRED:
self.emit('error', new ZKError(code));
break;
case ZK.ZOPERATIONTIMEOUT:
View
4 test/client.test.js
@@ -305,11 +305,11 @@ test('connect to non-existent zk', function (t) {
});
var gotConEvent;
ZK2.on('error', function (err) {
- t.equal(err.code, -4);
+ t.equal(err.code, -112);
t.ok(gotConEvent);
t.end();
});
- ZK2.on('connection_interrupted', function () {
+ ZK2.once('not_connected', function () {
gotConEvent = true;
});
ZK2.connect();

0 comments on commit a36e077

Please sign in to comment.