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

Improve error handling

Added individual error classes
Don't silently fail for commands without callback from now on
General polishing (e.g. better error messages)

Fix typos
This commit is contained in:
Ruben Bridgewater
2016-04-25 01:36:49 +02:00
parent bf394923fd
commit 03f1a606f7
18 changed files with 367 additions and 129 deletions

View File

@@ -79,7 +79,7 @@ Multi.prototype.monitor = Multi.prototype.MONITOR = function monitor (callback)
function quit_callback (self, callback) {
return function (err, res) {
if (err && err.code === 'NR_OFFLINE') {
if (err && err.code === 'NR_CLOSED') {
// Pretent the quit command worked properly in this case.
// Either the quit landed in the offline queue and was flushed at the reconnect
// or the offline queue is deactivated and the command was rejected right away
@@ -90,7 +90,7 @@ function quit_callback (self, callback) {
}
utils.callback_or_emit(self, callback, err, res);
if (self.stream.writable) {
// If the socket is still alive, kill it. This could happen if quit got a NR_OFFLINE error code
// If the socket is still alive, kill it. This could happen if quit got a NR_CLOSED error code
self.stream.destroy();
}
};