diff --git a/index.js b/index.js index b2b8aa2932..f724d56060 100644 --- a/index.js +++ b/index.js @@ -1055,7 +1055,7 @@ Multi.prototype.exec = function (callback) { if (typeof cur[cur.length - 1] === "function") { cur[cur.length - 1](err); } else { - errors.push(new Error(err)); + errors.push(err); } } }); @@ -1065,7 +1065,7 @@ Multi.prototype.exec = function (callback) { return this._client.send_command("exec", [], function (err, replies) { if (err) { if (callback) { - errors.push(new Error(err)); + errors.push(err); callback(errors); return; } else { diff --git a/test/commands/multi.spec.js b/test/commands/multi.spec.js index 11aae4f8b0..10b50f7c50 100644 --- a/test/commands/multi.spec.js +++ b/test/commands/multi.spec.js @@ -231,8 +231,8 @@ describe("The 'multi' method", function () { client.multi().set("foo").exec(function (err, reply) { assert(Array.isArray(err), "err should be an array"); assert.equal(2, err.length, "err should have 2 items"); - assert(err[0].message.match(/ERR/), "First error message should contain ERR"); - assert(err[1].message.match(/EXECABORT/), "First error message should contain EXECABORT"); + assert(err[0].message.match(/^ERR/), "First error message should begin with ERR"); + assert(err[1].message.match(/^EXECABORT/), "First error message should begin with EXECABORT"); return done(); }); });