1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

Fix error codes for multi.exec and add more tests

This commit is contained in:
Ruben Bridgewater
2015-09-19 18:15:23 +02:00
parent 2293f7ff85
commit 959b0ee093
2 changed files with 13 additions and 3 deletions

View File

@@ -1077,7 +1077,13 @@ Multi.prototype.execute_callback = function (err, replies) {
args = this.queue[i];
// If we asked for strings, even in detect_buffers mode, then return strings:
if (reply) {
if (reply instanceof Error) {
var match = reply.message.match(err_code);
// LUA script could return user errors that don't behave like all other errors!
if (match) {
reply.code = match[1];
}
} else if (reply) {
if (this._client.options.detect_buffers && this.wants_buffers[i] === false) {
replies[i - 1] = reply = reply_to_strings(reply);
}