Commit c39daeb8 authored by Ian Ward's avatar Ian Ward

Handle case when unable to connect to server

S will not be defined, but is expected to be defined by
connectionIssue.
parent 326426ee
......@@ -303,18 +303,24 @@ Client.config = {
});
}
// check for issues
// S not set if unable to connect to server
if (!S) {
var S = {
serverAddress: server,
tokens: server.split(':').reverse()
}
var message = error || 'Unable to connect to server';
memcached.connectionIssue(message, S);
return query.callback && memcached.makeCallback(query.callback,new Error(message));
}
// Other errors besides inability to connect to server
if (error) {
memcached.connectionIssue(error.toString(), S);
return query.callback && memcached.makeCallback(query.callback,error);
}
if (!S) {
var message = 'Connect did not give a server';
memcached.connectionIssue(message);
return query.callback && memcached.makeCallback(query.callback,new Error(message));
}
if (S.readyState !== 'open') {
var message = 'Connection readyState is set to ' + S.readyState;
memcached.connectionIssue(message, S);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment