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

String is not an error

This commit is contained in:
bobrik
2013-07-15 23:10:54 +04:00
committed by Bryce Baril
parent b12c49a207
commit 31c22be6b9

View File

@@ -137,12 +137,15 @@ RedisClient.prototype.unref = function () {
// flush offline_queue and command_queue, erroring any items with a callback first
RedisClient.prototype.flush_and_error = function (message) {
var command_obj;
var command_obj, error;
error = new Error(message);
while (this.offline_queue.length > 0) {
command_obj = this.offline_queue.shift();
if (typeof command_obj.callback === "function") {
try {
command_obj.callback(message);
command_obj.callback(error);
} catch (callback_err) {
process.nextTick(function () {
throw callback_err;
@@ -156,7 +159,7 @@ RedisClient.prototype.flush_and_error = function (message) {
command_obj = this.command_queue.shift();
if (typeof command_obj.callback === "function") {
try {
command_obj.callback(message);
command_obj.callback(error);
} catch (callback_err) {
process.nextTick(function () {
throw callback_err;