mranney/node_redis — Issue #164: Awkward Error Handling with MULTI/EXEC
Author: bohnman
Created: 2012-01-17 20:25:54+00:00
State: open

Consider the following program:

```javascript
var redis = require('redis');
var client = redis.createClient();

console.log("START");

client.zadd('test', 'a', 'b', function(err, reply) {
console.log("ZADD SINGLE:", err, reply);
});

client.multi()
.zadd('test', 'a', 'b', function(err, replies) {
console.log("ZADD MULTI:", err, replies);
})
.zadd('test', 1, 'c', function(err, replies) {
console.log("ZADD MULTI 2:", err, replies);
})
.exec(function(err, replies) {
console.log("EXEC:", err, replies);
client.quit();
console.log("END");
});
```

This outputs:

```
START
ZADD SINGLE: [Error: ERR value is not a double] undefined
ZADD MULTI: null ERR value is not a double
ZADD MULTI 2: null 0
EXEC: null [ 'ERR value is not a double', 0 ]
END
```

You'll notice that when we do ZADD by itself we get an Error object. However, when we do a multi/exec, in both the ZADD callback and the exec callback, we get a null value for the err argument. Also, the replies contain the error and they are strings, not error objects.

Is this the intended functionality? Seems a bit awkward.