You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Send friendlier error event on stream errors.
This commit is contained in:
9
index.js
9
index.js
@@ -411,17 +411,20 @@ function RedisClient(stream) {
|
||||
if (this.closing) {
|
||||
return;
|
||||
}
|
||||
|
||||
var message = "Redis connection to " + self.host + ":" + self.port + " failed - " + msg.message;
|
||||
|
||||
if (exports.debug_mode) {
|
||||
console.warn("Connecting to redis server: " + msg);
|
||||
console.warn(message);
|
||||
}
|
||||
self.offline_queue.forEach(function (args) {
|
||||
if (typeof args[2] === "function") {
|
||||
args[2]("Server connection could not be established");
|
||||
args[2](message);
|
||||
}
|
||||
});
|
||||
|
||||
self.connected = false;
|
||||
self.emit("error", msg);
|
||||
self.emit("error", new Error(message));
|
||||
});
|
||||
|
||||
this.stream.on("close", function () {
|
||||
|
Reference in New Issue
Block a user