1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

Merge pull request #139 from felixge/master

Fix: Hiredis parser traps pubsub event exceptions
This commit is contained in:
Matt Ranney
2011-11-13 20:23:23 -08:00
2 changed files with 52 additions and 9 deletions

View File

@@ -27,15 +27,20 @@ HiredisReplyParser.prototype.reset = function () {
HiredisReplyParser.prototype.execute = function (data) {
var reply;
this.reader.feed(data);
try {
while ((reply = this.reader.get()) !== undefined) {
if (reply && reply.constructor === Error) {
this.emit("reply error", reply);
} else {
this.emit("reply", reply);
}
while (true) {
try {
reply = this.reader.get();
} catch (err) {
this.emit("error", err);
break;
}
if (reply === undefined) break;
if (reply && reply.constructor === Error) {
this.emit("reply error", reply);
} else {
this.emit("reply", reply);
}
} catch (err) {
this.emit("error", err);
}
};