Skip to content

Commit 52db91c

Browse files
author
Ruben Bridgewater
committed
Fix js parser sending non-Errors
1 parent 614366f commit 52db91c

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,7 @@ RedisClient.prototype.init_parser = function () {
302302

303303
// "reply error" is an error sent back by Redis
304304
this.reply_parser.on("reply error", function (reply) {
305-
if (reply instanceof Error) {
306-
self.return_error(reply);
307-
} else {
308-
self.return_error(new Error(reply));
309-
}
305+
self.return_error(reply);
310306
});
311307
this.reply_parser.on("reply", function (reply) {
312308
self.return_reply(reply);
@@ -654,7 +650,9 @@ RedisClient.prototype.return_reply = function (reply) {
654650
}
655651

656652
try_callback(command_obj.callback, reply);
657-
} else debug("no callback for reply: " + (reply && reply.toString && reply.toString()));
653+
} else {
654+
debug("no callback for reply: " + (reply && reply.toString && reply.toString()));
655+
}
658656
} else if (this.pub_sub_mode || (command_obj && command_obj.sub_command)) {
659657
if (Array.isArray(reply)) {
660658
type = reply[0].toString();

lib/parser/javascript.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ ReplyParser.prototype.execute = function (buffer) {
177177
if (ret === null) {
178178
break;
179179
}
180-
181-
this.send_error(ret);
180+
this.send_error(new Error(ret));
182181
} else if (type === 58) { // :
183182
ret = this._parseResult(type);
184183

0 commit comments

Comments
 (0)