Document/standardize the return types from the fetch methods.
[awesomized/libmemcached] / libmemcached / error.cc
index 16608ff9eeb8b473cc9581e539c9fc553c6bae24..49375097db884b9555e34d6836c4fafc2a3cd296 100644 (file)
@@ -61,7 +61,6 @@ static void _set(memcached_st& memc, memcached_string_t *str, memcached_return_t
   // For memory allocation we use our error since it is a bit more specific
   if (local_errno == ENOMEM and rc == MEMCACHED_ERRNO)
   {
-    local_errno= ENOMEM;
     rc= MEMCACHED_MEMORY_ALLOCATION_FAILURE;
   }
 
@@ -81,6 +80,16 @@ static void _set(memcached_st& memc, memcached_string_t *str, memcached_return_t
     rc= MEMCACHED_CONNECTION_FAILURE;
   }
 
+  if (local_errno == EINVAL)
+  {
+    rc= MEMCACHED_INVALID_ARGUMENTS;
+  }
+
+  if (local_errno == ECONNREFUSED)
+  {
+    rc= MEMCACHED_CONNECTION_FAILURE;
+  }
+
   memcached_error_t *error= (struct memcached_error_t *)libmemcached_malloc(&memc, sizeof(struct memcached_error_t));
   if (not error) // Bad business if this happens
     return;