From c7633bf738ec6565f59076066bc73df3bcb5df4a Mon Sep 17 00:00:00 2001 From: Thanasis Polychronakis Date: Thu, 18 Apr 2013 21:48:35 +0300 Subject: [PATCH] fix unescaped exception in Multi.exec --- index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 6bc76d54a1..fcca3feba1 100644 --- a/index.js +++ b/index.js @@ -713,7 +713,7 @@ RedisClient.prototype.send_command = function (command, args, callback) { return callback(err); } } - + buffer_args = false; for (i = 0, il = args.length, arg; i < il; i += 1) { if (Buffer.isBuffer(args[i])) { @@ -1037,7 +1037,12 @@ Multi.prototype.exec = function (callback) { if (typeof cur[cur.length - 1] === "function") { cur[cur.length - 1](err); } else { - throw new Error(err); + if (callback) { + callback(new Error(err)); + return; + } else { + throw new Error(err); + } } self.queue.splice(index, 1); }