Update errors to make sure we return the real error.
[awesomized/libmemcached] / libmemcached / auto.cc
index 4196b6683deb4fc8a8affa6db2bd29ca584a4103..f9f84d7b699a1cc53d07a69a771c0c6624c970ea 100644 (file)
@@ -52,13 +52,15 @@ static void auto_response(org::libmemcached::Instance* instance, const bool repl
     rc= memcached_response(instance, &instance->root->result);
   }
 
-  if (memcached_success(rc))
+  if (memcached_fatal(rc))
   {
-    *value= instance->root->result.numeric_value;
+    fprintf(stderr, "%s\n", memcached_strerror(NULL, rc));
+    assert(memcached_last_error(instance->root) != MEMCACHED_SUCCESS);
+    *value= UINT64_MAX;
   }
   else
   {
-    *value= UINT64_MAX;
+    *value= instance->root->result.numeric_value;
   }
 }