From 71a52638de38da328bd2d9e773657405ffafe40b Mon Sep 17 00:00:00 2001 From: Shankar Karuppiah Date: Tue, 8 May 2012 15:50:31 +0300 Subject: [PATCH] Added checking for callback before attempting to execute the callback Signed-off-by: DTrejo --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index b3f0beda57..dacc113f41 100644 --- a/index.js +++ b/index.js @@ -672,7 +672,12 @@ RedisClient.prototype.send_command = function (command, args, callback) { this.offline_queue.push(command_obj); this.should_buffer = true; } else { - command_obj.callback(new Error('send command: stream is not writeable.')); + var not_writeable_error = new Error('send_command: stream not writeable. enable_offline_queue is false'); + if (command_obj.callback) { + command_obj.callback(not_writeable_error); + } else { + throw not_writeable_error; + } } return false;