You've already forked node-redis
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:
9
index.js
9
index.js
@@ -137,12 +137,15 @@ RedisClient.prototype.unref = function () {
|
|||||||
|
|
||||||
// flush offline_queue and command_queue, erroring any items with a callback first
|
// flush offline_queue and command_queue, erroring any items with a callback first
|
||||||
RedisClient.prototype.flush_and_error = function (message) {
|
RedisClient.prototype.flush_and_error = function (message) {
|
||||||
var command_obj;
|
var command_obj, error;
|
||||||
|
|
||||||
|
error = new Error(message);
|
||||||
|
|
||||||
while (this.offline_queue.length > 0) {
|
while (this.offline_queue.length > 0) {
|
||||||
command_obj = this.offline_queue.shift();
|
command_obj = this.offline_queue.shift();
|
||||||
if (typeof command_obj.callback === "function") {
|
if (typeof command_obj.callback === "function") {
|
||||||
try {
|
try {
|
||||||
command_obj.callback(message);
|
command_obj.callback(error);
|
||||||
} catch (callback_err) {
|
} catch (callback_err) {
|
||||||
process.nextTick(function () {
|
process.nextTick(function () {
|
||||||
throw callback_err;
|
throw callback_err;
|
||||||
@@ -156,7 +159,7 @@ RedisClient.prototype.flush_and_error = function (message) {
|
|||||||
command_obj = this.command_queue.shift();
|
command_obj = this.command_queue.shift();
|
||||||
if (typeof command_obj.callback === "function") {
|
if (typeof command_obj.callback === "function") {
|
||||||
try {
|
try {
|
||||||
command_obj.callback(message);
|
command_obj.callback(error);
|
||||||
} catch (callback_err) {
|
} catch (callback_err) {
|
||||||
process.nextTick(function () {
|
process.nextTick(function () {
|
||||||
throw callback_err;
|
throw callback_err;
|
||||||
|
Reference in New Issue
Block a user