Skip to content
This repository

Added error messages to replace the false argument in 2 query callbacks on server error #52

Merged
merged 2 commits into from about 2 years ago

2 participants

Ron Korving Arnout Kazemier
Ron Korving

As we discussed on IRC, we want all errors to yield a truthy error argument in the callback. Arguably, these should change to Error instances, but for the two I added I stuck with the current way of yielding errors (simple strings).

Arnout Kazemier
Owner

LGTM,

I think if we went with full new Error instances we would have to do a major version bump as backwards compatibility would break.

Anyways thanks for the pull request, i'll publish a new version a min

Arnout Kazemier 3rd-Eden merged commit 75452b4 into from
Arnout Kazemier 3rd-Eden closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. +3 3 lib/memcached.js
6 lib/memcached.js
@@ -245,7 +245,7 @@ Client.config = {
245 245
246 246 // check if the server is still alive
247 247 if (server in this.issues && this.issues[server].failed) {
248   - return query.callback && query.callback(false, false);
  248 + return query.callback && query.callback('Server not available');
249 249 }
250 250
251 251 this.connect(server, function allocateMemcachedConnection (error, S) {
@@ -256,10 +256,10 @@ Client.config = {
256 256 }
257 257
258 258 // check for issues
259   - if (!S) return query.callback && query.callback(false, false);
260   -
261 259 if (error) return query.callback && query.callback(error);
262 260
  261 + if (!S) return query.callback && query.callback('Connect did not give a server');
  262 +
263 263 if (S.readyState !== 'open') {
264 264 return query.callback && query.callback('Connection readyState is set to ' + S.readySate);
265 265 }

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.